# Zelviora Component Library — LLM Documentation (Angular)

This file contains documentation and source code examples for the Zelviora component library.


================================================================================
# COMPONENT: ACCORDION
================================================================================

## Documentation

# accordion — Angular

Processed requirements of [`<z-accordion>`](../../../../../requirements/04-components/navigation/accordion.md) and its
parts (`z-accordion-item`, `z-accordion-trigger`, `z-accordion-content`) for Angular (`@zelviora/angular`).

## Usage

```ts
import { Component, signal } from '@angular/core';
import { ZAccordion, ZAccordionContent, ZAccordionItem, ZAccordionTrigger } from '@zelviora/angular';

@Component({
  selector: 'app-faq',
  imports: [ZAccordion, ZAccordionContent, ZAccordionItem, ZAccordionTrigger],
  template: `
    <z-accordion [value]="open()" (zChange)="open.set($event.detail.value)">
      <z-accordion-item value="a">
        <z-accordion-trigger>Question</z-accordion-trigger>
        <z-accordion-content>Answer</z-accordion-content>
      </z-accordion-item>
    </z-accordion>
  `,
})
export class Faq { readonly open = signal<string | string[] | null>('a'); }
```

## Binding

| Input | Output | Detail |
|---|---|---|
| `[value]` (`string \| null`, or `string[]` with `multiple`) | `(zChange)` | `{ value, item, open, reason }` |

The accordion has no value accessor (it is not a form control).

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `accordion-default.ts` | D-1 Default |
| `multiple` | `accordion-multiple.ts` | D-21 Multiple, D-3 Variants (outline), D-7 Disabled, D-9 Controlled |

## Differences

- Boolean and number props are bound with `[prop]="…"` (`[required]="true"`, `[maxLength]="20"`), so the value reaches the element with its type.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZAccordion, ZAccordionContent, ZAccordionItem, ZAccordionTrigger } from '@zelviora/angular';

@Component({
  selector: 'demo-accordion-default',
  imports: [ZAccordion, ZAccordionContent, ZAccordionItem, ZAccordionTrigger],
  template: `
    <z-accordion defaultValue="shipping">
      <z-accordion-item value="shipping">
        <z-accordion-trigger>How long does shipping take?</z-accordion-trigger>
        <z-accordion-content>Orders arrive in 2–3 business days.</z-accordion-content>
      </z-accordion-item>
      <z-accordion-item value="returns">
        <z-accordion-trigger>Can I return an item?</z-accordion-trigger>
        <z-accordion-content>Yes, within 30 days of delivery.</z-accordion-content>
      </z-accordion-item>
      <z-accordion-item value="warranty">
        <z-accordion-trigger>Is there a warranty?</z-accordion-trigger>
        <z-accordion-content>Every product has a two-year warranty.</z-accordion-content>
      </z-accordion-item>
    </z-accordion>
  `,
})
export class AccordionDefault {}

```

### Case: multiple

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZAccordion, ZAccordionContent, ZAccordionItem, ZAccordionTrigger, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-accordion-multiple',
  imports: [ZAccordion, ZAccordionContent, ZAccordionItem, ZAccordionTrigger, ZStack],
  template: `
    <z-stack>
      <z-accordion [multiple]="true" variant="outline" [value]="open()" (zChange)="onChange($event.detail.value)">
        <z-accordion-item value="general">
          <z-accordion-trigger>General</z-accordion-trigger>
          <z-accordion-content>Language and time zone.</z-accordion-content>
        </z-accordion-item>
        <z-accordion-item value="privacy">
          <z-accordion-trigger>Privacy</z-accordion-trigger>
          <z-accordion-content>Who can see your profile.</z-accordion-content>
        </z-accordion-item>
        <z-accordion-item value="beta" [disabled]="true">
          <z-accordion-trigger>Beta features</z-accordion-trigger>
          <z-accordion-content>Not available on your plan.</z-accordion-content>
        </z-accordion-item>
      </z-accordion>
      <p>Open: {{ open().join(', ') || 'none' }}</p>
    </z-stack>
  `,
})
export class AccordionMultiple {
  readonly open = signal<string[]>(['general']);

  // With multiple, the value is always an array.
  onChange(value: string | string[] | null) {
    this.open.set(Array.isArray(value) ? value : []);
  }
}

```


================================================================================
# COMPONENT: AFFIX
================================================================================

## Documentation

# affix — Angular

Processed requirements of [`<z-affix>`](../../../../../requirements/04-components/navigation/affix.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-affix topOffset="64px">…</z-affix>
```

## Events

| Event | Detail | Notes |
|---|---|---|
| `zAffixChange` | `{ affixed: boolean }` | Not cancelable |

## Notes

- Attributes are `offset-top` / `offset-bottom` (spec names); the properties are `topOffset` / `bottomOffset` because `offsetTop` is a read-only `HTMLElement` property. A unitless number means pixels.
- Stuck content must not hide the focused element (FO-2, UX-G4-02): while the affix is stuck it sets `scroll-padding-block-start` (`offset-bottom`: `scroll-padding-block-end`) on its scroll container to its offset plus its height, and clears it when it stops being stuck or is removed. A value the app already set on that container is kept.
- The demos put fixed components in `demo-fixed-frame` (`contain: layout`) so they stay inside the preview.

## Customization CSS

```css
.demo-affix-shadow:state(affixed)::part(base) {
  box-shadow: var(--z-shadow-md);
}
```

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `affix-basic.ts` | D-1 Default, D-6 States |
| `bottom` | `affix-bottom.ts` | E-1 offset-bottom |
| `customization` | `affix-customization.ts` | D-18 Customization |


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZAffix, ZButton, ZCard, ZStack, ZText } from '@zelviora/angular';

@Component({
  selector: 'demo-affix-basic',
  imports: [ZAffix, ZButton, ZCard, ZStack, ZText],
  template: `
    <div class="demo-scroll-frame">
      <z-stack gap="md">
        <z-text>Scroll down: the toolbar sticks.</z-text>
        <z-affix topOffset="8px">
          <z-card size="sm"><z-stack orientation="horizontal" gap="sm"><z-button size="sm">Bold</z-button><z-button size="sm" variant="outline">Italic</z-button></z-stack></z-card>
        </z-affix>
        <div class="demo-long"></div>
      </z-stack>
    </div>
  `,
})
export class AffixBasic {}

```

### Case: bottom

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZAffix, ZButton, ZCard, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-affix-bottom',
  imports: [ZAffix, ZButton, ZCard, ZStack],
  template: `
    <div class="demo-scroll-frame">
      <z-stack gap="md">
        <div class="demo-long"></div>
        <z-affix bottomOffset="0">
          <z-card size="sm"><z-stack orientation="horizontal" gap="sm" justify="end"><z-button size="sm" variant="outline" tone="neutral">Cancel</z-button><z-button size="sm">Save</z-button></z-stack></z-card>
        </z-affix>
      </z-stack>
    </div>
  `,
})
export class AffixBottom {}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZAffix, ZCard, ZStack, ZText } from '@zelviora/angular';

@Component({
  selector: 'demo-affix-customization',
  imports: [ZAffix, ZCard, ZStack, ZText],
  template: `
    <div class="demo-scroll-frame">
      <z-stack gap="md">
        <z-text>Scroll down to see the shadow.</z-text>
        <z-affix class="demo-affix-shadow">
          <z-card size="sm"><z-text>Table of contents</z-text></z-card>
        </z-affix>
        <div class="demo-long"></div>
      </z-stack>
    </div>
  `,
})
export class AffixCustomization {}

```


================================================================================
# COMPONENT: ALERT
================================================================================

## Documentation

# alert — Angular

Processed requirements of [`<z-alert>`](../../../../../requirements/04-components/overlay-feedback/alert.md) for Angular (`@zelviora/angular`).

## Usage

```ts
import { Component } from '@angular/core';
import { ZAlert } from '@zelviora/angular';

@Component({
  selector: 'app-storage',
  imports: [ZAlert],
  template: `<z-alert tone="warning" heading="Storage almost full">You have used 90% of your storage.</z-alert>`,
})
export class Storage {}
```

## Binding

`[open]` + `(zOpenChange)` (no `[(open)]`: the output is `zOpenChange`, not `openChange`; D-031):

```html
<z-alert [dismissible]="true" [open]="open()" (zOpenChange)="open.set($event.detail.open)">…</z-alert>
```

## Events

| Output | Detail | Notes |
|---|---|---|
| `(zBeforeClose)` | `{ reason: 'close-button' }` | Cancelable: `$event.preventDefault()` keeps the alert open |
| `(zOpenChange)` | `{ open: false, reason: 'close-button' }` | Only for user closes, not when `open` is set by code |
| `(zAfterClose)` | `{}` | After the alert is hidden |

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `alert-basic.ts` | D-1 Default |
| `tones` | `alert-tones.ts` | D-3 Variants, D-4 Tones |
| `dismissible` | `alert-dismissible.ts` | D-9 Controlled, D-17 with actions |
| `live` | `alert-live.ts` | D-21 Live |

## Differences

- Boolean and number props are bound with `[prop]="…"` (`[required]="true"`, `[maxLength]="20"`), so the value reaches the element with its type.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZAlert } from '@zelviora/angular';

@Component({
  selector: 'demo-alert-basic',
  imports: [ZAlert],
  template: `<z-alert heading="Scheduled maintenance">The service will be unavailable on Sunday from 1:00 to 3:00.</z-alert>`,
})
export class AlertBasic {}

```

### Case: dismissible

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZAlert, ZButton, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-alert-dismissible',
  imports: [ZAlert, ZButton, ZStack],
  template: `
    <z-stack gap="md" align-items="start">
      <z-alert tone="info" [dismissible]="true" [open]="open()" (zOpenChange)="open.set($event.detail.open)">
        A new version is available.
        <z-button slot="actions" size="sm" variant="outline" tone="neutral">Update now</z-button>
      </z-alert>
      @if (!open()) {
        <z-button variant="link" (click)="open.set(true)">Show the alert again</z-button>
      }
    </z-stack>
  `,
})
export class AlertDismissible {
  readonly open = signal(true);
}

```

### Case: live

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZAlert, ZButton, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-alert-live',
  imports: [ZAlert, ZButton, ZStack],
  template: `
    <z-stack gap="md" align-items="start">
      <z-button (click)="error.set(true)">Upload file</z-button>
      @if (error()) {
        <z-alert tone="destructive" live="assertive" heading="Upload failed">The file is larger than 10 MB.</z-alert>
      }
    </z-stack>
  `,
})
export class AlertLive {
  readonly error = signal(false);
}

```

### Case: tones

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZAlert, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-alert-tones',
  imports: [ZAlert, ZStack],
  template: `
    <z-stack gap="md">
      <z-alert tone="success">Your changes were saved.</z-alert>
      <z-alert tone="warning" variant="outline" heading="Storage almost full">You have used 90% of your storage.</z-alert>
      <z-alert tone="destructive" variant="solid">The payment could not be processed.</z-alert>
      <z-alert tone="neutral">Drafts are kept for 30 days.</z-alert>
    </z-stack>
  `,
})
export class AlertTones {}

```


================================================================================
# COMPONENT: ALERT-DIALOG
================================================================================

## Documentation

# alert-dialog — Angular

Processed requirements of [`<z-alert-dialog>`](../../../../../requirements/04-components/overlay-feedback/alert-dialog.md)
for Angular (`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component } from '@angular/core';
import { ZAlertDialog, ZButton } from '@zelviora/angular';

@Component({
  selector: 'app-delete',
  imports: [ZAlertDialog, ZButton],
  template: `
    <z-alert-dialog heading="Delete project?" description="This cannot be undone." actionLabel="Delete" (zConfirm)="remove()">
      <z-button slot="trigger" tone="destructive">Delete</z-button>
    </z-alert-dialog>
  `,
})
export class Delete { remove() { /* … */ } }
```

## Imperative

`confirm({ heading, description, tone?, actionLabel?, cancelLabel?, target? })` (re-exported from the core) returns
`Promise<boolean>`: `true` when confirmed, `false` when cancelled or closed with Escape. The dialog is added to `target`
(default `document.body`, so it takes theme and locale from there) and removed after it closes. Browser only.

## Binding

`[open]` + `(zOpenChange)` (no `[(open)]`: the output is `zOpenChange`, not `openChange`).

## Events

`(zConfirm)` (cancelable: `$event.preventDefault()` keeps it open, use `[actionLoading]`), `(zCancel)`
(`{ reason: 'cancel' | 'escape' }`), `(zBeforeOpen)`, `(zBeforeClose)`, `(zOpenChange)`, `(zAfterOpen)`, `(zAfterClose)`.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `alert-dialog-default.ts` | D-1 Default |
| `async` | `alert-dialog-async.ts` | D-9 Controlled, D-20 actionLoading |
| `imperative` | `alert-dialog-imperative.ts` | D-21 Imperative |

## Differences

- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: async

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZAlertDialog, ZButton } from '@zelviora/angular';

/** Keeps the dialog open while a (fake) request runs: preventDefault() on confirm, then close from state. */
@Component({
  selector: 'demo-alert-dialog-async',
  imports: [ZAlertDialog, ZButton],
  template: `
    <z-alert-dialog
      heading="Leave the workspace?"
      description="You lose access to its projects until an owner invites you again."
      tone="warning"
      actionLabel="Leave"
      [open]="open()"
      [actionLoading]="loading()"
      (zOpenChange)="open.set($event.detail.open)"
      (zConfirm)="confirm($event)"
      (zCancel)="loading.set(false)"
    >
      <z-button slot="trigger" variant="outline" tone="warning">Leave workspace</z-button>
    </z-alert-dialog>
  `,
})
export class AlertDialogAsync {
  readonly open = signal(false);
  readonly loading = signal(false);

  confirm(e: Event) {
    e.preventDefault();
    this.loading.set(true);
    setTimeout(() => {
      this.loading.set(false);
      this.open.set(false);
    }, 1000);
  }
}

```

### Case: default

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZAlertDialog, ZButton, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-alert-dialog-default',
  imports: [ZAlertDialog, ZButton, ZStack],
  template: `
    <z-stack gap="sm">
      <z-alert-dialog
        heading="Delete project?"
        description="The project and its 24 files are deleted permanently. This cannot be undone."
        actionLabel="Delete"
        (zConfirm)="result.set('deleted')"
        (zCancel)="result.set('kept (' + $event.detail.reason + ')')"
      >
        <z-button slot="trigger" tone="destructive">Delete project</z-button>
      </z-alert-dialog>
      <span>Result: {{ result() }}</span>
    </z-stack>
  `,
})
export class AlertDialogDefault {
  readonly result = signal('none yet');
}

```

### Case: imperative

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZStack, confirm } from '@zelviora/angular';

/** confirm() opens an alert dialog from code and resolves true (confirmed) or false (cancelled / Escape). */
@Component({
  selector: 'demo-alert-dialog-imperative',
  imports: [ZButton, ZStack],
  template: `
    <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
      <z-button tone="destructive" (click)="remove()">Delete project</z-button>
      <span role="status">{{ result() }}</span>
    </z-stack>
  `,
})
export class AlertDialogImperative {
  readonly result = signal('No answer yet');

  async remove() {
    const ok = await confirm({
      heading: 'Delete project?',
      description: 'The project and its 12 files are removed. This cannot be undone.',
      tone: 'destructive',
      actionLabel: 'Delete',
    });
    this.result.set(ok ? 'Deleted' : 'Kept');
  }
}

```


================================================================================
# COMPONENT: ANCHOR
================================================================================

## Documentation

# anchor — Angular

Processed requirements of [`<z-anchor>` and `<z-anchor-link>`](../../../../../requirements/04-components/navigation/anchor.md)
for Angular (`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component } from '@angular/core';
import { ZAnchor, ZAnchorLink } from '@zelviora/angular';

@Component({
  selector: 'app-toc',
  imports: [ZAnchor, ZAnchorLink],
  template: `
    <z-anchor [offset]="64" (zChange)="current = $event.detail.value">
      <z-anchor-link href="#install">Install</z-anchor-link>
      <z-anchor-link href="#usage">Usage</z-anchor-link>
    </z-anchor>
  `,
})
export class Toc { current: string | null = null; }
```

Without `target` the window scroll is followed; pass an element (or a selector) to follow a scroll container.

## Binding

No two-way binding: the current link is decided by scrolling. Listen to `(zChange)` (`{ value, reason }`, `value` is
the `href` of the current link). Method (through `viewChild(…, { read: ElementRef })`): `scrollToHref(href)` (reason `programmatic`).

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `anchor-default.ts` | D-1 Default, D-6 States, D-9 Controlled (zChange log), D-15 Keyboard-only |
| `nested` | `anchor-nested.ts` | D-14 Long content (2 levels, long labels), D-17 Composition (sticky header + offset) |

## Differences

- `scrollToHref(href)` takes a link `href` (named so it does not shadow the native `Element.scrollTo`).
- Section ids are prefixed per framework in the demos so the previews of several frameworks on one page do not share ids.
- Boolean and number props are bound with `[prop]="…"`, so the value reaches the element with its type.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: default

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZAnchor, ZAnchorLink, ZHeading, ZStack, ZText } from '@zelviora/angular';

/** Five sections in a scroll container (`target`); the link of the section being read is marked while scrolling. */
@Component({
  selector: 'demo-anchor-default',
  imports: [ZAnchor, ZAnchorLink, ZHeading, ZStack, ZText],
  template: `
    <z-stack gap="sm">
      <z-stack orientation="horizontal" gap="md">
        <z-anchor class="demo-anchor-toc" [target]="scroller" (zChange)="last.set($event.detail.value + ' (' + $event.detail.reason + ')')">
          @for (p of parts; track p) {
            <z-anchor-link [href]="'#ng-anchor-' + p.toLowerCase()">{{ p }}</z-anchor-link>
          }
        </z-anchor>
        <div #scroller class="demo-anchor-scroll" tabindex="0">
          @for (p of parts; track p) {
            <section [id]="'ng-anchor-' + p.toLowerCase()" class="demo-anchor-section">
              <z-heading [level]="3">{{ p }}</z-heading>
              <z-text as="p">Scroll this box or use the links: the table of contents follows the section being read.</z-text>
            </section>
          }
        </div>
      </z-stack>
      <span>zChange: {{ last() || 'none yet' }}</span>
    </z-stack>
  `,
})
export class AnchorDefault {
  readonly parts = ['Overview', 'Install', 'Usage', 'Theming', 'FAQ'];
  readonly last = signal('');
}

```

### Case: nested

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZAnchor, ZAnchorLink, ZHeading, ZStack, ZText } from '@zelviora/angular';

/** Two levels (`sub` slot), long labels, smooth scrolling and an `offset` for the sticky header of the container. */
@Component({
  selector: 'demo-anchor-nested',
  imports: [ZAnchor, ZAnchorLink, ZHeading, ZStack, ZText],
  template: `
    <z-stack orientation="horizontal" gap="md">
      <z-anchor class="demo-anchor-toc" label="Guide" [target]="scroller" [offset]="48" [smooth]="true">
        <z-anchor-link href="#ng-guide-start">Getting started</z-anchor-link>
        <z-anchor-link href="#ng-guide-config">
          Configuration
          <z-anchor-link slot="sub" href="#ng-guide-tokens">Design tokens and brand themes for every product</z-anchor-link>
          <z-anchor-link slot="sub" href="#ng-guide-locale">Locale</z-anchor-link>
        </z-anchor-link>
        <z-anchor-link href="#ng-guide-deploy">Deploy</z-anchor-link>
      </z-anchor>
      <div #scroller class="demo-anchor-scroll" tabindex="0">
        <div class="demo-anchor-sticky"><z-text>Sticky header (offset 48)</z-text></div>
        <section id="ng-guide-start" class="demo-anchor-section"><z-heading [level]="3">Getting started</z-heading></section>
        <section id="ng-guide-config" class="demo-anchor-section"><z-heading [level]="3">Configuration</z-heading></section>
        <section id="ng-guide-tokens" class="demo-anchor-section"><z-heading [level]="4">Design tokens</z-heading></section>
        <section id="ng-guide-locale" class="demo-anchor-section"><z-heading [level]="4">Locale</z-heading></section>
        <section id="ng-guide-deploy" class="demo-anchor-section"><z-heading [level]="3">Deploy</z-heading></section>
      </div>
    </z-stack>
  `,
})
export class AnchorNested {}

```


================================================================================
# COMPONENT: APP-SHELL
================================================================================

## Documentation

# app-shell — Angular

Processed requirements of [`<z-app-shell>`](../../../../../requirements/04-components/layout/app-shell.md) for Angular
(`@zelviora/angular`, standalone components).

## Usage

```html
<z-app-shell breakpoint="lg" hotkey="Mod+B" [navCollapsed]="collapsed()" (zCollapseChange)="collapsed.set($event.detail.navCollapsed)">
  <z-text slot="header" variant="strong">Acme Admin</z-text>
  <z-sidebar slot="nav" label="Main navigation">…</z-sidebar>
  
  <z-text slot="footer">…</z-text>
</z-app-shell>
```

## Binding and events

Layout state, not a form control (spec §12, `model-events.ts`): bind the prop + event, no `ngModel`.

| Input | Output | Detail |
|---|---|---|
| `[navCollapsed]` (wide mode) | `(zCollapseChange)` | `{ navCollapsed }` |
| `[navOpen]` (narrow mode, drawer) | `(zOpenChange)` | `{ navOpen, reason }` |
| | `(zBeforeClose)` (cancelable: `$event.preventDefault()`) | `{ reason }` |
| | `(zModeChange)` when the container crosses `breakpoint` | `{ mode: 'wide' \| 'narrow' }` |

`hotkey` (P-keyboard-shortcuts syntax, `Mod+B` = Ctrl+B, ⌘B on macOS) toggles the navigation; no shortcut unless it is
set.

`fill` sets the height: `container` takes 100% of the container and only `main` scrolls (the container needs a
height); `page` makes the shell at least the viewport height, the page scrolls and the header and navigation stick;
`auto` (default) is `container` inside a scroll container (an element with `overflow` other than `visible`/`clip`),
otherwise `page`. A frame with a height but no `overflow` needs `fill="container"`.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `app-shell-default.ts` | D-1 Default (wide, navigation open), D-14 Long content (sticky header), D-15 Keyboard-only (skip link, toggle, `hotkey="Mod+B"`) |
| `narrow` | `app-shell-narrow.ts` | D-5 Sizes (`breakpoint`), D-6 States (narrow closed / open), D-9 Controlled (`navOpen`) |
| `controlled` | `app-shell-controlled.ts` | D-9 Controlled (`navCollapsed`), D-3 Variants (sticky header off) |
| `collapse-mode` | `app-shell-collapse-mode.ts` | D-3 Variants (`collapseMode` icon / offcanvas, `side="end"`), D-6 States (collapsed) |

Content (navigation items with their Material Symbols icons, orders, labels) comes from `data.ts`, generated from
`documents/shared/app-shell/data.ts` and identical in React, Vue and Angular (DEM-2, DOCS-SITE-GAP-D02).

The shell picks its mode from its own width (BP-4). The docs column (~582px) is narrower than `sm`, so the wide-mode
demos (`default`, `controlled`, `collapse-mode`, `breakpoint="sm"`) sit in a 64rem (1024px) frame inside a horizontal
scroller, resizable from its corner to watch wide → collapsed → narrow (DEMO-026, APP-SHELL-GAP-D02). The narrow demo
uses `breakpoint="xl"` (80rem) in the column width to force the drawer.

Not yet covered: D-2 Playground, D-11 RTL, D-12/D-13 Dark/Brand, D-16 Density, D-17 Composition (dropdown menu and
breadcrumb in the header), D-18 Customization, D-19 i18n, D-21 Responsive (a dedicated case).

## Demo classes

The demos use these rules of `src/styles/demo.css` (copy them into the app stylesheet only for a framed preview; a real
app lets the shell fill the page):

```css
/* Frame of an app shell demo: a bounded area instead of the whole page; the shell takes its height, main scrolls. */
.demo-app-shell-frame {
  block-size: calc(var(--z-space-24) * 4.5);
  overflow: auto;
  border: var(--z-border-width-1) solid var(--z-color-border);
  border-radius: var(--z-radius-md);
}

/* Wide-mode frame (64rem) in a horizontal scroller, resizable. */
.demo-app-shell-scroll {
  max-inline-size: 100%;
  overflow-x: auto;
}

.demo-app-shell-wide {
  inline-size: 64rem;
  min-inline-size: 20rem;
  resize: horizontal;
}
```

## Differences

- The wide-mode cases use `breakpoint="sm"` in a 64rem frame and the narrow case `breakpoint="xl"` so the docs column
  shows the intended mode; an app usually keeps the default `lg`.
- `zModeChange` fires only when the mode changes after the first measure: the app starts from the mode it expects.
- No shortcut by default: only the `default` case sets `hotkey="Mod+B"` (P-keyboard-shortcuts syntax), so one key press
  does not toggle several shells of the docs page.
- Bind booleans with `[prop]="true"`; plain attributes are strings.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: collapse-mode

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SelectValueAccessor, ZAppShell, ZIcon, ZSegmented, ZSegmentedItem, ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack, ZText } from '@zelviora/angular';
import { docsNavLabel, docsTitle, itemHref, sectionItems, sectionsLabel, texts } from '../data';

/** `collapseMode` icon (an icon strip stays) or offcanvas (the column hides); the navigation sits at the end. */
@Component({
  selector: 'demo-app-shell-collapse-mode',
  imports: [FormsModule, SelectValueAccessor, ZAppShell, ZIcon, ZSegmented, ZSegmentedItem, ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack, ZText],
  template: `
    <z-stack gap="sm">
      <z-segmented [label]="texts.collapseModeLabel" [ngModel]="mode()" (ngModelChange)="mode.set($event)">
        <z-segmented-item value="icon">Icon</z-segmented-item>
        <z-segmented-item value="offcanvas">Offcanvas</z-segmented-item>
      </z-segmented>
      <div class="demo-app-shell-scroll">
        <z-app-shell class="demo-app-shell-frame demo-app-shell-wide" breakpoint="sm" side="end" [collapseMode]="mode()" [disableStickyHeader]="true">
          <z-text slot="header" variant="strong">{{ docsTitle }}</z-text>
          <z-sidebar slot="nav" [label]="docsNavLabel">
            <z-sidebar-group [label]="sectionsLabel">
              @for (item of sectionItems; track item.value; let i = $index) {
                <z-sidebar-item [href]="itemHref('collapse-mode', item.value)" [current]="i === 0">
                  <z-icon slot="icon" [name]="item.icon"></z-icon>
                  {{ item.label }}
                </z-sidebar-item>
              }
            </z-sidebar-group>
          </z-sidebar>
          <z-text>{{ texts.collapseModeHint(mode()) }}</z-text>
        </z-app-shell>
      </div>
    </z-stack>
  `,
})
export class AppShellCollapseMode {
  readonly mode = signal<'icon' | 'offcanvas'>('icon');
  readonly docsTitle = docsTitle;
  readonly docsNavLabel = docsNavLabel;
  readonly sectionsLabel = sectionsLabel;
  readonly sectionItems = sectionItems;
  readonly texts = texts;
  readonly itemHref = itemHref;
}

```

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import type { ZAppShellCollapseChangeDetail } from '@zelviora/core';
import { ZAppShell, ZButton, ZIcon, ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack, ZText } from '@zelviora/angular';
import { itemHref, navLabel, shellTitle, texts, workspaceItems, workspaceLabel } from '../data';

/** The app holds `navCollapsed` (wide mode) and updates it on `zCollapseChange` (no `hotkey`, so no shortcut). */
@Component({
  selector: 'demo-app-shell-controlled',
  imports: [ZAppShell, ZButton, ZIcon, ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack, ZText],
  template: `
    <z-stack gap="sm">
      <z-stack orientation="horizontal" align-items="center" gap="sm">
        <z-button size="sm" variant="outline" tone="neutral" (click)="navCollapsed.set(!navCollapsed())">
          {{ navCollapsed() ? texts.expand : texts.collapse }}
        </z-button>
        <z-text variant="muted" size="sm">navCollapsed = {{ navCollapsed() }}</z-text>
      </z-stack>
      <div class="demo-app-shell-scroll">
        <z-app-shell
          class="demo-app-shell-frame demo-app-shell-wide"
          breakpoint="sm"
          [disableStickyHeader]="true"
          [navCollapsed]="navCollapsed()"
          (zCollapseChange)="onCollapse($event.detail)"
        >
          <z-text slot="header" variant="strong">{{ shellTitle }}</z-text>
          <z-sidebar slot="nav" [label]="navLabel">
            <z-sidebar-group [label]="workspaceLabel">
              @for (item of workspaceItems; track item.value; let i = $index) {
                <z-sidebar-item [href]="itemHref('controlled', item.value)" [current]="i === 0">
                  <z-icon slot="icon" [name]="item.icon"></z-icon>
                  {{ item.label }}
                </z-sidebar-item>
              }
            </z-sidebar-group>
          </z-sidebar>
          <z-text>{{ texts.controlledHint }}</z-text>
        </z-app-shell>
      </div>
    </z-stack>
  `,
})
export class AppShellControlled {
  readonly navCollapsed = signal(false);
  readonly shellTitle = shellTitle;
  readonly navLabel = navLabel;
  readonly workspaceLabel = workspaceLabel;
  readonly workspaceItems = workspaceItems;
  readonly texts = texts;
  readonly itemHref = itemHref;

  onCollapse(detail: ZAppShellCollapseChangeDetail) {
    this.navCollapsed.set(detail.navCollapsed);
  }
}

```

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZAppShell, ZBadge, ZIcon, ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack, ZText } from '@zelviora/angular';
import { footer, itemHref, navLabel, orderLine, recentOrders, recentOrdersTitle, shellTitle, workspaceItems, workspaceLabel } from '../data';

/** Wide mode with the navigation open; the header stays on top while the content scrolls. `hotkey="Mod+B"`: Ctrl+B (⌘B) collapses it. */
@Component({
  selector: 'demo-app-shell-default',
  imports: [ZAppShell, ZBadge, ZIcon, ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack, ZText],
  template: `
    <div class="demo-app-shell-scroll">
      <z-app-shell class="demo-app-shell-frame demo-app-shell-wide" breakpoint="sm" nav-label="Main" hotkey="Mod+B">
        <z-text slot="header" variant="strong">{{ shellTitle }}</z-text>
        <z-sidebar slot="nav" [label]="navLabel">
          <z-sidebar-group [label]="workspaceLabel">
            @for (item of workspaceItems; track item.value; let i = $index) {
              <z-sidebar-item [href]="itemHref('default', item.value)" [current]="i === 0">
                <z-icon slot="icon" [name]="item.icon"></z-icon>
                {{ item.label }}
                @if (item.badge) {
                  <z-badge slot="end">{{ item.badge }}</z-badge>
                }
              </z-sidebar-item>
            }
          </z-sidebar-group>
        </z-sidebar>
        <z-stack gap="sm">
          <z-text variant="strong">{{ recentOrdersTitle }}</z-text>
          @for (o of recentOrders; track o.id) {
            <z-text>{{ orderLine(o) }}</z-text>
          }
        </z-stack>
        <z-text slot="footer" variant="muted" size="sm">{{ footer }}</z-text>
      </z-app-shell>
    </div>
  `,
})
export class AppShellDefault {
  readonly shellTitle = shellTitle;
  readonly navLabel = navLabel;
  readonly workspaceLabel = workspaceLabel;
  readonly workspaceItems = workspaceItems;
  readonly recentOrdersTitle = recentOrdersTitle;
  readonly recentOrders = recentOrders;
  readonly footer = footer;
  readonly itemHref = itemHref;
  readonly orderLine = orderLine;
}

```

### Case: narrow

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import type { ZAppShellOpenChangeDetail } from '@zelviora/core';
import { ZAppShell, ZButton, ZIcon, ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack, ZText } from '@zelviora/angular';
import { itemHref, narrowItems, navLabel, texts, workspaceLabel } from '../data';

/**
 * Below `breakpoint` (container width, here xl = 80rem) the navigation becomes a modal drawer opened by the toggle;
 * Escape, a click outside or choosing an item closes it. The app holds `navOpen` and logs `zModeChange`.
 */
@Component({
  selector: 'demo-app-shell-narrow',
  imports: [ZAppShell, ZButton, ZIcon, ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack, ZText],
  template: `
    <z-app-shell
      class="demo-app-shell-frame"
      breakpoint="xl"
      [navOpen]="navOpen()"
      (zOpenChange)="onOpen($event.detail)"
      (zModeChange)="mode.set($event.detail.mode)"
    >
      <z-text slot="header" variant="strong">{{ texts.narrowTitle }}</z-text>
      <z-sidebar slot="nav" [label]="navLabel">
        <z-sidebar-group [label]="workspaceLabel">
          @for (item of narrowItems; track item.value; let i = $index) {
            <z-sidebar-item [href]="itemHref('narrow', item.value)" [current]="i === 0">
              <z-icon slot="icon" [name]="item.icon"></z-icon>
              {{ item.label }}
            </z-sidebar-item>
          }
        </z-sidebar-group>
      </z-sidebar>
      <z-stack gap="sm" align-items="start">
        <z-button size="sm" variant="outline" tone="neutral" [disabled]="mode() !== 'narrow'" (click)="navOpen.set(true)">{{ texts.openNav }}</z-button>
        <z-text variant="muted" size="sm">mode = {{ mode() }}, navOpen = {{ navOpen() }}, last reason = {{ reason() }}</z-text>
      </z-stack>
    </z-app-shell>
  `,
})
export class AppShellNarrow {
  readonly navOpen = signal(false);
  readonly mode = signal<string>('-');
  readonly reason = signal('-');
  readonly navLabel = navLabel;
  readonly workspaceLabel = workspaceLabel;
  readonly narrowItems = narrowItems;
  readonly texts = texts;
  readonly itemHref = itemHref;

  onOpen(detail: ZAppShellOpenChangeDetail) {
    this.navOpen.set(detail.navOpen);
    this.reason.set(detail.reason);
  }
}

```


================================================================================
# COMPONENT: AREA-CHART
================================================================================

## Documentation

# Area chart (`<z-area-chart>`)

Filled and stacked area charts for cumulative volume and bandwidth telemetry.

## Installation & Import

```tsx
// React (@zelviora/react-chart)
import { ZAreaChart } from '@zelviora/react-chart';

// Vue 3 (@zelviora/vue-chart)
import { ZAreaChart } from '@zelviora/vue-chart';

// Angular (@zelviora/angular-chart)
import { ZAreaChart } from '@zelviora/angular-chart';

// Web Components (@zelviora/chart)
import '@zelviora/chart';
```

## Key Features

- **Tree-shaken ECharts 6 Core**: Automatically registers only the required ECharts chart module and components.
- **Design System Token Synchronization**: Reads `--z-chart-series-1..8`, `--z-chart-grid-color`, and `--z-chart-axis-color`, reacting automatically to Light/Dark mode and theme preset changes.
- **Built-in Accessibility (WCAG AAA)**: Renders a semantic `<figure>` with `<figcaption>`, interactive `aria-pressed` legend toggles, and a synchronized `<table>` for screen readers.
- **Escape Hatch (`option`)**: Deep-merges any raw ECharts `option` object on top of the declarative props.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZAreaChart } from '@zelviora/angular-chart';
import { bandwidthData, bandwidthSeries } from '../data';

@Component({
  selector: 'demo-area-chart-basic',
  imports: [ZAreaChart],
  template: `
    <z-area-chart
      heading="Cluster Network Throughput (Gbps)"
      description="Inbound and outbound traffic volume sampled across six intervals."
      xKey="window" [data]="data" [series]="series"
    ></z-area-chart>
  `,
})
export class AreaChartBasic {
  readonly data = bandwidthData;
  readonly series = bandwidthSeries;
}

```

### Case: controlled

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/angular';
import { ZAreaChart, type ChartPointSelectDetail, type ChartSeriesToggleDetail } from '@zelviora/angular-chart';
import { bandwidthData, bandwidthSeries } from '../data';

@Component({
  selector: 'demo-area-chart-controlled',
  imports: [ZStack, ZButton, ZBadge, ZText, ZAreaChart],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <z-button size="sm" variant="outline" (click)="hidden = []">
          Show All Series
        </z-button>
        <z-badge tone="primary" variant="soft">{{ selected }}</z-badge>
        <z-text variant="muted" size="sm">
          Hidden: {{ hidden.length ? hidden.join(', ') : 'none' }}
        </z-text>
      </z-stack>
      <z-area-chart
        heading="Cluster Network Throughput (Gbps) (Interactive)"
        description="Inbound and outbound traffic volume sampled across six intervals."
        xKey="window" [data]="data" [series]="series"
        [selectable]="true"
        [hiddenSeries]="hidden"
        (zSeriesToggle)="onToggle($event)"
        (zPointSelect)="onSelect($event)"
      ></z-area-chart>
    </z-stack>
  `,
})
export class AreaChartControlled {
  readonly data = bandwidthData;
  readonly series = bandwidthSeries;
  hidden: string[] = [];
  selected = 'Click any chart element to inspect';

  onToggle(e: CustomEvent<ChartSeriesToggleDetail>) {
    this.hidden = e.detail.hiddenSeries;
  }

  onSelect(e: CustomEvent<ChartPointSelectDetail>) {
    this.selected = `Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`;
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZAreaChart } from '@zelviora/angular-chart';
import { bandwidthData, bandwidthSeries } from '../data';

@Component({
  selector: 'demo-area-chart-customization',
  imports: [ZAreaChart],
  template: `
    <z-area-chart
      class="demo-chart-brand"
      description="Inbound and outbound traffic volume sampled across six intervals."
      [valueFormat]="{ maximumFractionDigits: 1 }"
      xKey="window" [data]="data" [series]="series" [stacked]="true" [dataZoom]="true" [areaOpacity]="0.28" renderer="canvas"
    >
      <span slot="heading">Cluster Network Throughput (Gbps) — Custom Theme Tokens &amp; Canvas</span>
    </z-area-chart>
  `,
})
export class AreaChartCustomization {
  readonly data = bandwidthData;
  readonly series = bandwidthSeries;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZAreaChart } from '@zelviora/angular-chart';
import { bandwidthData, bandwidthSeries } from '../data';

@Component({
  selector: 'demo-area-chart-states',
  imports: [ZStack, ZAreaChart],
  template: `
    <z-stack gap="lg">
      <z-area-chart
        heading="Loading State (aria-busy)"
        [loading]="true"
        xKey="window" [data]="data" [series]="series"
      ></z-area-chart>
      <z-area-chart
        heading="Empty State"
        [data]="[]"
        [series]="series"
      ></z-area-chart>
      <z-area-chart
        heading="Expanded Accessible Data Table"
        description="Inbound and outbound traffic volume sampled across six intervals."
        [showDataTable]="true"
        xKey="window" [data]="data" [series]="series"
      ></z-area-chart>
    </z-stack>
  `,
})
export class AreaChartStates {
  readonly data = bandwidthData;
  readonly series = bandwidthSeries;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZAreaChart } from '@zelviora/angular-chart';
import { bandwidthData, bandwidthSeries } from '../data';

@Component({
  selector: 'demo-area-chart-variants',
  imports: [ZStack, ZAreaChart],
  template: `
    <z-stack gap="lg">
      <z-area-chart
        heading="Stacked Cumulative Area"
        description="Stacked cumulative area chart with higher fill opacity vs unstacked clean area without symbols."
        xKey="window" [data]="data" [series]="series" [stacked]="true" [smooth]="true" [areaOpacity]="0.35"
      ></z-area-chart>
      <z-area-chart
        heading="Subtle Unstacked Fill"
        description="Stacked cumulative area chart with higher fill opacity vs unstacked clean area without symbols."
        xKey="window" [data]="data" [series]="series" [areaOpacity]="0.12" [showSymbol]="false"
      ></z-area-chart>
    </z-stack>
  `,
})
export class AreaChartVariants {
  readonly data = bandwidthData;
  readonly series = bandwidthSeries;
}

```


================================================================================
# COMPONENT: ASPECT-RATIO
================================================================================

## Documentation

# aspect-ratio — Angular

Processed requirements of [`<z-aspect-ratio>`](../../../../../requirements/04-components/base/aspect-ratio.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-aspect-ratio ratio="16/9"><img src="/map.png" alt="Branch map" /></z-aspect-ratio>
```

## Customization CSS

```css
.demo-aspect-rounded::part(base) {
  border-radius: var(--z-radius-md);
}
```

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `aspect-ratio-basic.ts` | D-1 Default |
| `ratios` | `aspect-ratio-ratios.ts` | D-21 Ratios |
| `fit` | `aspect-ratio-fit.ts` | D-3 Variants, D-14 Long content |
| `composition` | `aspect-ratio-composition.ts` | D-17 Composition, D-18 Customization |


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZAspectRatio } from '@zelviora/angular';

@Component({
  selector: 'demo-aspect-ratio-basic',
  imports: [ZAspectRatio],
  template: `
    <z-aspect-ratio ratio="16/9">
      <img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 90'%3E%3Crect width='160' height='90' fill='%2393c5fd'/%3E%3Ccircle cx='50' cy='45' r='20' fill='%231d4ed8'/%3E%3C/svg%3E" alt="Map of the branch offices" />
    </z-aspect-ratio>
  `,
})
export class AspectRatioBasic {}

```

### Case: composition

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZAspectRatio, ZCard } from '@zelviora/angular';

@Component({
  selector: 'demo-aspect-ratio-composition',
  imports: [ZAspectRatio, ZCard],
  template: `
    <z-card heading="Head office" description="12 Le Loi, District 1" class="demo-narrow">
      <z-aspect-ratio ratio="4/3" class="demo-aspect-rounded"><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 90'%3E%3Crect width='160' height='90' fill='%2393c5fd'/%3E%3Ccircle cx='50' cy='45' r='20' fill='%231d4ed8'/%3E%3C/svg%3E" alt="Head office building" /></z-aspect-ratio>
    </z-card>
  `,
})
export class AspectRatioComposition {}

```

### Case: fit

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZAspectRatio, ZGrid } from '@zelviora/angular';

@Component({
  selector: 'demo-aspect-ratio-fit',
  imports: [ZAspectRatio, ZGrid],
  template: `
    <z-grid columns="3" gap="md">
      <z-aspect-ratio ratio="16/9" fit="cover"><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 90 160'%3E%3Crect width='90' height='160' fill='%2386efac'/%3E%3Crect x='25' y='40' width='40' height='80' fill='%2315803d'/%3E%3C/svg%3E" alt="Portrait, cover" /></z-aspect-ratio>
      <z-aspect-ratio ratio="16/9" fit="contain"><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 90 160'%3E%3Crect width='90' height='160' fill='%2386efac'/%3E%3Crect x='25' y='40' width='40' height='80' fill='%2315803d'/%3E%3C/svg%3E" alt="Portrait, contain" /></z-aspect-ratio>
      <z-aspect-ratio ratio="16/9" fit="fill"><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 90 160'%3E%3Crect width='90' height='160' fill='%2386efac'/%3E%3Crect x='25' y='40' width='40' height='80' fill='%2315803d'/%3E%3C/svg%3E" alt="Portrait, fill" /></z-aspect-ratio>
    </z-grid>
  `,
})
export class AspectRatioFit {}

```

### Case: ratios

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZAspectRatio, ZGrid } from '@zelviora/angular';

@Component({
  selector: 'demo-aspect-ratio-ratios',
  imports: [ZAspectRatio, ZGrid],
  template: `
    <z-grid columns="2" gap="md">
      <z-aspect-ratio ratio="1/1"><div class="demo-media">1/1</div></z-aspect-ratio>
      <z-aspect-ratio ratio="4:3"><div class="demo-media">4:3</div></z-aspect-ratio>
      <z-aspect-ratio ratio="21/9"><div class="demo-media">21/9</div></z-aspect-ratio>
      <z-aspect-ratio ratio="1.5"><div class="demo-media">1.5</div></z-aspect-ratio>
    </z-grid>
  `,
})
export class AspectRatioRatios {}

```


================================================================================
# COMPONENT: AUTOCOMPLETE
================================================================================

## Documentation

# autocomplete — Angular

Processed requirements of [`<z-autocomplete>` (suggestions declared with `<z-select-option>` or the `options` property)](../../../../../requirements/04-components/form/autocomplete.md)
for Angular (`@zelviora/angular`).

## Usage

```html
<z-autocomplete name="email" label="Email" type="email" [options]="suggestions" [(ngModel)]="email"></z-autocomplete>
```

## Binding

| Value accessor | Model | Event | Detail |
|---|---|---|---|
| `TextValueAccessor` | `[(ngModel)]` / `formControl` (`string`) | `(zInput)` | `{ value }` |
| — | `[open]` (no two-way binding, D-031) | `(zOpenChange)` | `{ open, reason }` |

## Events

`(zInput)`, `(zChange)`, `(zSelect)`, `(zOpenChange)`, `(zBeforeOpen)`, `(zBeforeClose)`, `(zClear)`, `(zAfterOpen)`, `(zAfterClose)`.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `autocomplete-default.ts` | D-1 Default, D-21 Email domain suggestions, D-9 Controlled |
| `inline` | `autocomplete-inline.ts` | D-22 Inline completion |
| `form` | `autocomplete-form.ts` | D-10 In form (text submitted), D-8 Error (required, bad email), D-17 Composition (field) |
| `history` | `autocomplete-history.ts` | D-24 Search history (descriptions), clearable |
| `i18n` | `autocomplete-i18n.ts` | D-19 i18n |

## Differences

- Boolean, number, array and function props are bound with `[prop]="…"` so the value reaches the element with its type.
- The value is the text: choosing a suggestion fills its `value` (a cancelable select event comes first).
- Without matches the popup stays closed unless the `empty` slot has content.
- Form reset does not emit events: reset the bound value yourself.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: default

#### Angular
```typescript
import { Component, computed, signal } from '@angular/core';
import { ZAutocomplete, ZStack } from '@zelviora/angular';

const DOMAINS = ['gmail.com', 'zelviora.vn', 'outlook.com', 'yahoo.com'];

/** Free text with suggestions computed from the typed text: the value is the text (model event `zInput`). */
@Component({
  selector: 'demo-autocomplete-default',
  imports: [ZAutocomplete, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-autocomplete label="Email" type="email" placeholder="name@example.com" [clearable]="true" [value]="email()" [options]="options()" (zInput)="email.set($event.detail.value)"></z-autocomplete>
      <span>Value: {{ email() || '(empty)' }}</span>
    </z-stack>
  `,
})
export class AutocompleteDefault {
  readonly email = signal('');
  readonly options = computed(() => {
    const local = this.email().split('@')[0] ?? '';
    return local ? DOMAINS.map((d) => ({ value: `${local}@${d}`, label: `${local}@${d}` })) : [];
  });
}

```

### Case: form

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZAutocomplete, ZButton, ZField, ZSelectOption, ZStack } from '@zelviora/angular';

/**
 * Native form: the text is submitted; required email inside a field (a bad address shows typeMismatch); reset.
 * FormsModule is not imported, so the form stays native and the element submits its own FormData entries.
 */
@Component({
  selector: 'demo-autocomplete-form',
  imports: [ZAutocomplete, ZButton, ZField, ZSelectOption, ZStack],
  template: `
    <form class="demo-narrow" (submit)="submit($event)">
      <z-stack>
        <z-field label="Email" hint="Required, a valid address" [required]="true">
          <z-autocomplete name="email" type="email" [required]="true">
            <z-select-option value="an@zelviora.vn">an@zelviora.vn</z-select-option>
            <z-select-option value="binh@zelviora.vn">binh@zelviora.vn</z-select-option>
          </z-autocomplete>
        </z-field>
        <z-autocomplete name="city" label="City" value="Helsinki">
          <z-select-option value="Boston">Boston</z-select-option>
          <z-select-option value="Helsinki">Helsinki</z-select-option>
          <z-select-option value="Seattle">Seattle</z-select-option>
        </z-autocomplete>
        <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
          <z-button type="submit">Submit</z-button>
          <z-button type="reset" variant="outline" tone="neutral">Reset</z-button>
        </z-stack>
        @if (sent()) {
          <output>{{ sent() }}</output>
        }
      </z-stack>
    </form>
  `,
})
export class AutocompleteForm {
  readonly sent = signal('');

  submit(e: Event) {
    e.preventDefault();
    this.sent.set(JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]));
  }
}

```

### Case: history

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { TextValueAccessor, ZAutocomplete, ZStack } from '@zelviora/angular';
import type { ZSelectOptionData } from '@zelviora/core';

const HISTORY: ZSelectOptionData[] = [
  { value: 'running shoes', label: 'running shoes', description: 'Searched today' },
  { value: 'windbreaker jacket', label: 'windbreaker jacket', description: 'Searched yesterday' },
  { value: 'insulated water bottle', label: 'insulated water bottle', description: 'Searched last week' },
];

/** Recent searches with a description line; clearable search box; `[(ngModel)]` through TextValueAccessor (`zInput`). */
@Component({
  selector: 'demo-autocomplete-history',
  imports: [FormsModule, TextValueAccessor, ZAutocomplete, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-autocomplete label="Search" type="search" [clearable]="true" [minChars]="0" [options]="history" [(ngModel)]="query" (zChange)="submitted.set($event.detail.value)"></z-autocomplete>
      <span>Last committed search: {{ submitted() || '(none)' }}</span>
    </z-stack>
  `,
})
export class AutocompleteHistory {
  readonly history = HISTORY;
  query = '';
  readonly submitted = signal('');
}

```

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZAutocomplete, ZConfigProvider, ZSelectOption } from '@zelviora/angular';

/** With locale `vi` inline completion ignores accents ("da" completes "Đà Lạt") and the built-in texts are Vietnamese. */
@Component({
  selector: 'demo-autocomplete-i18n',
  imports: [ZAutocomplete, ZConfigProvider, ZSelectOption],
  template: `
    <z-config-provider locale="vi">
      <div class="demo-narrow">
        <z-autocomplete label="Điểm đến" hint='Gõ "h" hoặc "đà"' [inlineComplete]="true">
          @for (p of places; track p) {
            <z-select-option [value]="p">{{ p }}</z-select-option>
          }
        </z-autocomplete>
      </div>
    </z-config-provider>
  `,
})
export class AutocompleteI18n {
  readonly places = ['Đà Lạt', 'Đà Nẵng', 'Hà Nội', 'Hạ Long', 'Huế', 'Hội An', 'Phú Quốc', 'Sa Pa'];
}

```

### Case: inline

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZAutocomplete, ZSelectOption, ZStack } from '@zelviora/angular';

const PLACES = ['Dallas', 'Denver', 'Dublin', 'Edinburgh', 'Geneva', 'Hamburg', 'Havana', 'Helsinki'];

/** inline-complete: the rest of the first match is filled in and selected; Backspace does not complete again. */
@Component({
  selector: 'demo-autocomplete-inline',
  imports: [ZAutocomplete, ZSelectOption, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-autocomplete label="Destination" hint='Type "h" or "da"' [inlineComplete]="true">
        @for (p of places; track p) {
          <z-select-option [value]="p">{{ p }}</z-select-option>
        }
      </z-autocomplete>
    </z-stack>
  `,
})
export class AutocompleteInline {
  readonly places = PLACES;
}

```


================================================================================
# COMPONENT: AVATAR
================================================================================

## Documentation

# avatar — Angular

Processed requirements of [`<z-avatar>`](../../../../../requirements/04-components/base/avatar.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-avatar src="/u/an.jpg" name="Anna Lee"></z-avatar>
```

## Binding

No model event. `alt=""` makes the avatar decorative (use it when the name is shown next to it).

## Events

`zLoad` when the picture has loaded, `zError` `{ error: 'load' }` when it failed (the fallback stays).

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `avatar-basic.ts` | D-1 Default |
| `variants` | `avatar-variants.ts` | D-3 Variants, D-4 Tones, D-5 Sizes |
| `fallback` | `avatar-fallback.ts` | D-6 States, D-8 Error, D-14 Long content, D-20 Empty |
| `group` | `avatar-group.ts` | D-17 Composition, D-19 i18n |


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZAvatar, ZStack } from '@zelviora/angular';

// Sample picture kept in the demo (no external image, demo-standards §5).
const PHOTO =
  "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' fill='%2393c5fd'/%3E%3Ccircle cx='32' cy='25' r='12' fill='%231e3a8a'/%3E%3Cpath d='M10 64c2-14 11-20 22-20s20 6 22 20z' fill='%231e3a8a'/%3E%3C/svg%3E";

@Component({
  selector: 'demo-avatar-basic',
  imports: [ZAvatar, ZStack],
  template: `
    <z-stack orientation="horizontal" align-items="center" gap="md">
      <z-avatar [src]="photo" name="Anna Lee"></z-avatar>
      <z-avatar name="Mark Tran"></z-avatar>
    </z-stack>
  `,
})
export class AvatarBasic {
  readonly photo = PHOTO;
}

```

### Case: fallback

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZAvatar, ZIcon, ZStack, ZText } from '@zelviora/angular';

@Component({
  selector: 'demo-avatar-fallback',
  imports: [ZAvatar, ZIcon, ZStack, ZText],
  template: `
    <z-stack gap="sm">
      <z-stack orientation="horizontal" align-items="center" gap="md" [wrap]="true">
        <z-avatar [src]="broken" name="Daniel Hughes" (zError)="status.set('image failed, initials shown')" (zLoad)="status.set('loaded')"></z-avatar>
        <z-avatar name="👨‍👩‍👧 Family" tone="info"></z-avatar>
        <z-avatar alt="Guest"></z-avatar>
        <z-avatar name="Support team">
          <z-icon slot="fallback" name="person"></z-icon>
        </z-avatar>
      </z-stack>
      <z-text variant="muted" size="sm">First avatar: {{ status() }}</z-text>
    </z-stack>
  `,
})
export class AvatarFallback {
  readonly broken = 'data:image/png;base64,AAAA';
  readonly status = signal('loading…');
}

```

### Case: group

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZAvatar, ZAvatarGroup, ZBadge, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-avatar-group',
  imports: [ZAvatar, ZAvatarGroup, ZBadge, ZStack],
  template: `
    <z-stack orientation="horizontal" align-items="center" gap="lg" [wrap]="true">
      <z-avatar-group [max]="3" label="Project team">
        @for (name of team; track name) {
          <z-avatar [name]="name" tone="auto"></z-avatar>
        }
      </z-avatar-group>
      <z-badge mode="overlay" [dot]="true" tone="success" label="Online">
        <z-avatar name="Anna Lee" size="lg"></z-avatar>
      </z-badge>
    </z-stack>
  `,
})
export class AvatarGroup {
  readonly team = ['Anna Lee', 'Mark Tran', 'Chloe Martin', 'David Park', 'Hannah Brooks'];
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZAvatar, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-avatar-variants',
  imports: [ZAvatar, ZStack],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" align-items="center" gap="sm">
        @for (size of sizes; track size) {
          <z-avatar [size]="size" [name]="'Size ' + size.toUpperCase()"></z-avatar>
        }
      </z-stack>
      <z-stack orientation="horizontal" align-items="center" gap="sm">
        <z-avatar shape="circle" name="Circle Shape" tone="primary"></z-avatar>
        <z-avatar shape="square" name="Square Shape" tone="primary"></z-avatar>
      </z-stack>
      <z-stack orientation="horizontal" align-items="center" gap="sm" [wrap]="true">
        @for (tone of tones; track tone) {
          <z-avatar [tone]="tone" [name]="tone + ' tone'"></z-avatar>
        }
      </z-stack>
      <z-stack orientation="horizontal" align-items="center" gap="sm">
        @for (name of people; track name) {
          <z-avatar tone="auto" [name]="name"></z-avatar>
        }
      </z-stack>
    </z-stack>
  `,
})
export class AvatarVariants {
  readonly sizes = ['xs', 'sm', 'md', 'lg', 'xl'] as const;
  readonly tones = ['neutral', 'primary', 'success', 'warning', 'destructive', 'info'] as const;
  readonly people = ['Chloe Martin', 'David Park', 'Hannah Brooks'];
}

```


================================================================================
# COMPONENT: BACK-TOP
================================================================================

## Documentation

# back-top — Angular

Processed requirements of [`<z-back-top>`](../../../../../requirements/04-components/navigation/back-top.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-back-top></z-back-top>
```

## Notes

- Fixed or sticky content must not hide the focused element (FO-2): give the page `scroll-padding-top` / `scroll-padding-bottom` equal to its size (the library does not set it).
- The demos put fixed components in `demo-fixed-frame` (`contain: layout`) so they stay inside the preview.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `back-top-basic.ts` | D-1 Default, D-6 States |
| `custom` | `back-top-custom.ts` | D-15 Keyboard-only (initialFocus), D-18 Customization, D-19 i18n |


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBackTop, ZLink, ZStack, ZText } from '@zelviora/angular';

@Component({
  selector: 'demo-back-top-basic',
  imports: [ZBackTop, ZLink, ZStack, ZText],
  template: `
    <div class="demo-fixed-frame">
      <div id="back-top-basic-angular" class="demo-scroll-frame">
        <z-stack gap="md" class="demo-long">
          <z-link href="#back-top-basic-angular">First link</z-link>
          <z-text>Scroll this area down.</z-text>
        </z-stack>
      </div>
      <z-back-top target="#back-top-basic-angular" [visibilityHeight]="120"></z-back-top>
    </div>
  `,
})
export class BackTopBasic {}

```

### Case: custom

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBackTop, ZButton, ZIcon, ZStack, ZText } from '@zelviora/angular';

@Component({
  selector: 'demo-back-top-custom',
  imports: [ZBackTop, ZButton, ZIcon, ZStack, ZText],
  template: `
    <div class="demo-fixed-frame">
      <div id="back-top-custom-angular" class="demo-scroll-frame">
        <z-stack gap="md" class="demo-long">
          <z-button id="back-top-custom-start-angular" variant="link">Start of the list</z-button>
          <z-text>Scroll this area down.</z-text>
        </z-stack>
      </div>
      <z-back-top target="#back-top-custom-angular" [visibilityHeight]="120" label="Back to the start of the list" initialFocus="#back-top-custom-start-angular"><z-icon slot="icon" name="vertical_align_top"></z-icon></z-back-top>
    </div>
  `,
})
export class BackTopCustom {}

```


================================================================================
# COMPONENT: BADGE
================================================================================

## Documentation

# badge — Angular

Processed requirements of [`<z-badge>`](../../../../../requirements/04-components/base/badge.md) for Angular (`@zelviora/angular`).

## Usage

```ts
import { Component } from '@angular/core';
import { ZBadge, ZButton } from '@zelviora/angular';

@Component({
  selector: 'app-inbox',
  imports: [ZBadge, ZButton],
  template: `
    <z-badge tone="success">Approved</z-badge>
    <z-badge mode="overlay" [count]="5" [label]="label">
      <z-button>Notifications, 5 unread</z-button>
    </z-badge>
  `,
})
export class Inbox { readonly label = '{count} unread notifications'; }
```

In overlay mode `label` is required: it is read by screen readers after the wrapped element (`{count}` is replaced by
the formatted count). The badge text is not part of the wrapped control's name, so also put the count in that control's
label when it matters. Bind a `label` that contains `{count}` from a field (`[label]="label"`): a literal `{` in a
template is Angular ICU syntax.

## Binding

No model event; `count` is a plain input.

## Events

None.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `badge-basic.ts` | D-1 Default |
| `tones` | `badge-tones.ts` | D-3 Variants, D-4 Tones |
| `overlay` | `badge-overlay.ts` | D-9 Controlled count, D-21 Overlay dot |

## Differences

- Boolean and number props are bound with `[prop]="…"` (`[required]="true"`, `[maxLength]="20"`), so the value reaches the element with its type.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge } from '@zelviora/angular';

@Component({
  selector: 'demo-badge-basic',
  imports: [ZBadge],
  template: `<z-badge>New</z-badge>`,
})
export class BadgeBasic {}

```

### Case: overlay

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZBadge, ZButton, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-badge-overlay',
  imports: [ZBadge, ZButton, ZStack],
  template: `
    <z-stack orientation="horizontal" align-items="center" gap="lg" [wrap]="true">
      <z-badge mode="overlay" variant="solid" tone="destructive" [count]="count()" [max]="99" [label]="countLabel">
        <z-button variant="outline" tone="neutral" (click)="count.set(count() + 50)">Notifications</z-button>
      </z-badge>
      <z-badge mode="overlay" variant="solid" tone="primary" [dot]="true" label="New activity">
        <z-button variant="outline" tone="neutral">Activity</z-button>
      </z-badge>
    </z-stack>
  `,
})
export class BadgeOverlay {
  readonly count = signal(5);
  // The badge replaces {count} with the formatted count; bound from a field so the braces stay literal.
  readonly countLabel = '{count} unread notifications';
}

```

### Case: tones

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-badge-tones',
  imports: [ZBadge, ZStack],
  template: `
    <z-stack gap="md">
      @for (variant of variants; track variant) {
        <z-stack orientation="horizontal" [wrap]="true" gap="sm">
          @for (tone of tones; track tone) {
            <z-badge [tone]="tone" [variant]="variant">{{ tone }}</z-badge>
          }
        </z-stack>
      }
    </z-stack>
  `,
})
export class BadgeTones {
  readonly tones = ['neutral', 'primary', 'success', 'warning', 'destructive', 'info'] as const;
  readonly variants = ['soft', 'solid', 'outline'] as const;
}

```


================================================================================
# COMPONENT: BANNER
================================================================================

## Documentation

# banner — Angular

Processed requirements of [`<z-banner>`](../../../../../requirements/04-components/overlay-feedback/banner.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-banner tone="warning">Maintenance on Sunday.</z-banner>
```

## Binding

`[open]` + `(zOpenChange)` (no two-way binding for `open`, D-031).

## Events

| Event | Detail | Notes |
|---|---|---|
| `zBeforeClose` | `{ reason: 'close-button' }` | Cancelable: `preventDefault()` keeps the banner open |
| `zOpenChange` | `{ open: false, reason }` | User close only; with `persistKey` the close is remembered in `localStorage` (`x:banner:<key>`) |
| `zAfterClose` | `{}` | After the banner is hidden |

## Notes

- Fixed or sticky content must not hide the focused element (FO-2): give the page `scroll-padding-top` / `scroll-padding-bottom` equal to its size (the library does not set it).
- The demos put fixed components in `demo-fixed-frame` (`contain: layout`) so they stay inside the preview.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `banner-basic.ts` | D-1 Default |
| `tones` | `banner-tones.ts` | D-3 Variants, D-4 Tones, D-8 Error |
| `controlled` | `banner-controlled.ts` | D-9 Controlled |
| `sticky` | `banner-sticky.ts` | D-6 States (sticky) |


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBanner } from '@zelviora/angular';

@Component({
  selector: 'demo-banner-basic',
  imports: [ZBanner],
  template: `
    <z-banner>Scheduled maintenance on Sunday from 1:00 to 3:00.</z-banner>
  `,
})
export class BannerBasic {}

```

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZBanner, ZButton, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-banner-controlled',
  imports: [ZBanner, ZButton, ZStack],
  template: `
    <z-stack gap="md" align-items="start">
      <z-banner tone="primary" [dismissible]="true" [open]="open()" (zOpenChange)="open.set($event.detail.open)">
        Try the new dashboard.
        <z-button slot="actions" size="sm" variant="outline" tone="neutral">Open it</z-button>
      </z-banner>
      @if (!open()) {
        <z-button variant="link" (click)="open.set(true)">Show the banner again</z-button>
      }
    </z-stack>
  `,
})
export class BannerControlled {
  readonly open = signal(true);
}

```

### Case: sticky

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBanner, ZStack, ZText } from '@zelviora/angular';

@Component({
  selector: 'demo-banner-sticky',
  imports: [ZBanner, ZStack, ZText],
  template: `
    <div class="demo-scroll-frame">
      <z-banner [sticky]="true" tone="warning" label="Maintenance">Maintenance tonight at 22:00.</z-banner>
      <z-stack gap="md" class="demo-long">
        <z-text>Scroll this area: the banner stays at the top.</z-text>
      </z-stack>
    </div>
  `,
})
export class BannerSticky {}

```

### Case: tones

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBanner, ZButton, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-banner-tones',
  imports: [ZBanner, ZButton, ZStack],
  template: `
    <z-stack gap="sm">
      <z-banner tone="info" label="Release">Version 2.0 is out.</z-banner>
      <z-banner tone="success" label="Saved">All changes are saved.</z-banner>
      <z-banner tone="warning" label="Trial">Your trial ends in 3 days.<z-button slot="actions" size="sm" variant="outline" tone="neutral">Upgrade</z-button></z-banner>
      <z-banner tone="destructive" variant="solid" label="Outage">Payments are currently unavailable.</z-banner>
      <z-banner tone="neutral" variant="solid" label="Notice">Read-only mode.</z-banner>
    </z-stack>
  `,
})
export class BannerTones {}

```


================================================================================
# COMPONENT: BAR-CHART
================================================================================

## Documentation

# Bar chart (`<z-bar-chart>`)

Vertical, horizontal, grouped, and stacked bar charts powered by ECharts BarChart.

## Installation & Import

```tsx
// React (@zelviora/react-chart)
import { ZBarChart } from '@zelviora/react-chart';

// Vue 3 (@zelviora/vue-chart)
import { ZBarChart } from '@zelviora/vue-chart';

// Angular (@zelviora/angular-chart)
import { ZBarChart } from '@zelviora/angular-chart';

// Web Components (@zelviora/chart)
import '@zelviora/chart';
```

## Key Features

- **Tree-shaken ECharts 6 Core**: Automatically registers only the required ECharts chart module and components.
- **Design System Token Synchronization**: Reads `--z-chart-series-1..8`, `--z-chart-grid-color`, and `--z-chart-axis-color`, reacting automatically to Light/Dark mode and theme preset changes.
- **Built-in Accessibility (WCAG AAA)**: Renders a semantic `<figure>` with `<figcaption>`, interactive `aria-pressed` legend toggles, and a synchronized `<table>` for screen readers.
- **Escape Hatch (`option`)**: Deep-merges any raw ECharts `option` object on top of the declarative props.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBarChart } from '@zelviora/angular-chart';
import { revenueData, revenueSeries } from '../data';

@Component({
  selector: 'demo-bar-chart-basic',
  imports: [ZBarChart],
  template: `
    <z-bar-chart
      heading="Quarterly Cloud Infrastructure Revenue (Million USD)"
      description="Revenue comparison between 2024 and 2025 across four fiscal quarters."
      xKey="quarter" [data]="data" [series]="series"
    ></z-bar-chart>
  `,
})
export class BarChartBasic {
  readonly data = revenueData;
  readonly series = revenueSeries;
}

```

### Case: controlled

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/angular';
import { ZBarChart, type ChartPointSelectDetail, type ChartSeriesToggleDetail } from '@zelviora/angular-chart';
import { revenueData, revenueSeries } from '../data';

@Component({
  selector: 'demo-bar-chart-controlled',
  imports: [ZStack, ZButton, ZBadge, ZText, ZBarChart],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <z-button size="sm" variant="outline" (click)="hidden = []">
          Show All Series
        </z-button>
        <z-badge tone="primary" variant="soft">{{ selected }}</z-badge>
        <z-text variant="muted" size="sm">
          Hidden: {{ hidden.length ? hidden.join(', ') : 'none' }}
        </z-text>
      </z-stack>
      <z-bar-chart
        heading="Quarterly Cloud Infrastructure Revenue (Million USD) (Interactive)"
        description="Revenue comparison between 2024 and 2025 across four fiscal quarters."
        xKey="quarter" [data]="data" [series]="series"
        [selectable]="true"
        [hiddenSeries]="hidden"
        (zSeriesToggle)="onToggle($event)"
        (zPointSelect)="onSelect($event)"
      ></z-bar-chart>
    </z-stack>
  `,
})
export class BarChartControlled {
  readonly data = revenueData;
  readonly series = revenueSeries;
  hidden: string[] = [];
  selected = 'Click any chart element to inspect';

  onToggle(e: CustomEvent<ChartSeriesToggleDetail>) {
    this.hidden = e.detail.hiddenSeries;
  }

  onSelect(e: CustomEvent<ChartPointSelectDetail>) {
    this.selected = `Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`;
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBarChart } from '@zelviora/angular-chart';
import { revenueData, revenueSeries } from '../data';

@Component({
  selector: 'demo-bar-chart-customization',
  imports: [ZBarChart],
  template: `
    <z-bar-chart
      class="demo-chart-brand"
      description="Revenue comparison between 2024 and 2025 across four fiscal quarters."
      [valueFormat]="{ maximumFractionDigits: 1 }"
      xKey="quarter" [data]="data" [series]="series" [dataZoom]="true" [borderRadius]="6" renderer="canvas"
    >
      <span slot="heading">Quarterly Cloud Infrastructure Revenue (Million USD) — Custom Theme Tokens &amp; Canvas</span>
    </z-bar-chart>
  `,
})
export class BarChartCustomization {
  readonly data = revenueData;
  readonly series = revenueSeries;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZBarChart } from '@zelviora/angular-chart';
import { revenueData, revenueSeries } from '../data';

@Component({
  selector: 'demo-bar-chart-states',
  imports: [ZStack, ZBarChart],
  template: `
    <z-stack gap="lg">
      <z-bar-chart
        heading="Loading State (aria-busy)"
        [loading]="true"
        xKey="quarter" [data]="data" [series]="series"
      ></z-bar-chart>
      <z-bar-chart
        heading="Empty State"
        [data]="[]"
        [series]="series"
      ></z-bar-chart>
      <z-bar-chart
        heading="Expanded Accessible Data Table"
        description="Revenue comparison between 2024 and 2025 across four fiscal quarters."
        [showDataTable]="true"
        xKey="quarter" [data]="data" [series]="series"
      ></z-bar-chart>
    </z-stack>
  `,
})
export class BarChartStates {
  readonly data = revenueData;
  readonly series = revenueSeries;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZBarChart } from '@zelviora/angular-chart';
import { revenueData, revenueSeries } from '../data';

@Component({
  selector: 'demo-bar-chart-variants',
  imports: [ZStack, ZBarChart],
  template: `
    <z-stack gap="lg">
      <z-bar-chart
        heading="Horizontal Bar Layout"
        description="Horizontal bar layout with rounded corners alongside stacked vertical bars."
        xKey="quarter" [data]="data" [series]="series" orientation="horizontal" [borderRadius]="6"
      ></z-bar-chart>
      <z-bar-chart
        heading="Stacked Vertical Bars"
        description="Horizontal bar layout with rounded corners alongside stacked vertical bars."
        xKey="quarter" [data]="data" [series]="series" [stacked]="true" [barMaxWidth]="36" [borderRadius]="4"
      ></z-bar-chart>
    </z-stack>
  `,
})
export class BarChartVariants {
  readonly data = revenueData;
  readonly series = revenueSeries;
}

```


================================================================================
# COMPONENT: BOXPLOT-CHART
================================================================================

## Documentation

# Boxplot chart (`<z-boxplot-chart>`)

Five-number summary box-and-whisker plots (min, Q1, median, Q3, max) for statistical dispersion.

## Installation & Import

```tsx
// React (@zelviora/react-chart)
import { ZBoxplotChart } from '@zelviora/react-chart';

// Vue 3 (@zelviora/vue-chart)
import { ZBoxplotChart } from '@zelviora/vue-chart';

// Angular (@zelviora/angular-chart)
import { ZBoxplotChart } from '@zelviora/angular-chart';

// Web Components (@zelviora/chart)
import '@zelviora/chart';
```

## Key Features

- **Tree-shaken ECharts 6 Core**: Automatically registers only the required ECharts chart module and components.
- **Design System Token Synchronization**: Reads `--z-chart-series-1..8`, `--z-chart-grid-color`, and `--z-chart-axis-color`, reacting automatically to Light/Dark mode and theme preset changes.
- **Built-in Accessibility (WCAG AAA)**: Renders a semantic `<figure>` with `<figcaption>`, interactive `aria-pressed` legend toggles, and a synchronized `<table>` for screen readers.
- **Escape Hatch (`option`)**: Deep-merges any raw ECharts `option` object on top of the declarative props.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBoxplotChart } from '@zelviora/angular-chart';
import { boxplotData, boxplotSeries } from '../data';

@Component({
  selector: 'demo-boxplot-chart-basic',
  imports: [ZBoxplotChart],
  template: `
    <z-boxplot-chart
      heading="Service Latency Quartile Distribution (ms)"
      description="Five-number latency distribution across Gateway, Auth, Search, and Billing services."
      xKey="service" minKey="min" q1Key="q1" medianKey="median" q3Key="q3" maxKey="max" [data]="data" [series]="series"
    ></z-boxplot-chart>
  `,
})
export class BoxplotChartBasic {
  readonly data = boxplotData;
  readonly series = boxplotSeries;
}

```

### Case: controlled

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/angular';
import { ZBoxplotChart, type ChartPointSelectDetail, type ChartSeriesToggleDetail } from '@zelviora/angular-chart';
import { boxplotData, boxplotSeries } from '../data';

@Component({
  selector: 'demo-boxplot-chart-controlled',
  imports: [ZStack, ZButton, ZBadge, ZText, ZBoxplotChart],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <z-button size="sm" variant="outline" (click)="hidden = []">
          Show All Series
        </z-button>
        <z-badge tone="primary" variant="soft">{{ selected }}</z-badge>
        <z-text variant="muted" size="sm">
          Hidden: {{ hidden.length ? hidden.join(', ') : 'none' }}
        </z-text>
      </z-stack>
      <z-boxplot-chart
        heading="Service Latency Quartile Distribution (ms) (Interactive)"
        description="Five-number latency distribution across Gateway, Auth, Search, and Billing services."
        xKey="service" minKey="min" q1Key="q1" medianKey="median" q3Key="q3" maxKey="max" [data]="data" [series]="series"
        [selectable]="true"
        [hiddenSeries]="hidden"
        (zSeriesToggle)="onToggle($event)"
        (zPointSelect)="onSelect($event)"
      ></z-boxplot-chart>
    </z-stack>
  `,
})
export class BoxplotChartControlled {
  readonly data = boxplotData;
  readonly series = boxplotSeries;
  hidden: string[] = [];
  selected = 'Click any chart element to inspect';

  onToggle(e: CustomEvent<ChartSeriesToggleDetail>) {
    this.hidden = e.detail.hiddenSeries;
  }

  onSelect(e: CustomEvent<ChartPointSelectDetail>) {
    this.selected = `Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`;
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBoxplotChart } from '@zelviora/angular-chart';
import { boxplotData, boxplotSeries } from '../data';

@Component({
  selector: 'demo-boxplot-chart-customization',
  imports: [ZBoxplotChart],
  template: `
    <z-boxplot-chart
      class="demo-chart-brand"
      description="Five-number latency distribution across Gateway, Auth, Search, and Billing services."
      [valueFormat]="{ maximumFractionDigits: 1 }"
      xKey="service" minKey="min" q1Key="q1" medianKey="median" q3Key="q3" maxKey="max" renderer="canvas" [data]="data" [series]="series"
    >
      <span slot="heading">Service Latency Quartile Distribution (ms) — Custom Theme Tokens &amp; Canvas</span>
    </z-boxplot-chart>
  `,
})
export class BoxplotChartCustomization {
  readonly data = boxplotData;
  readonly series = boxplotSeries;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZBoxplotChart } from '@zelviora/angular-chart';
import { boxplotData, boxplotSeries } from '../data';

@Component({
  selector: 'demo-boxplot-chart-states',
  imports: [ZStack, ZBoxplotChart],
  template: `
    <z-stack gap="lg">
      <z-boxplot-chart
        heading="Loading State (aria-busy)"
        [loading]="true"
        xKey="service" minKey="min" q1Key="q1" medianKey="median" q3Key="q3" maxKey="max" [data]="data" [series]="series"
      ></z-boxplot-chart>
      <z-boxplot-chart
        heading="Empty State"
        [data]="[]"
        [series]="series"
      ></z-boxplot-chart>
      <z-boxplot-chart
        heading="Expanded Accessible Data Table"
        description="Five-number latency distribution across Gateway, Auth, Search, and Billing services."
        [showDataTable]="true"
        xKey="service" minKey="min" q1Key="q1" medianKey="median" q3Key="q3" maxKey="max" [data]="data" [series]="series"
      ></z-boxplot-chart>
    </z-stack>
  `,
})
export class BoxplotChartStates {
  readonly data = boxplotData;
  readonly series = boxplotSeries;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZBoxplotChart } from '@zelviora/angular-chart';
import { boxplotData, boxplotSeries } from '../data';

@Component({
  selector: 'demo-boxplot-chart-variants',
  imports: [ZStack, ZBoxplotChart],
  template: `
    <z-stack gap="lg">
      <z-boxplot-chart
        heading="Quartile Summary with Legend"
        description="Boxplot with legend visible vs compact distribution view."
        xKey="service" minKey="min" q1Key="q1" medianKey="median" q3Key="q3" maxKey="max" [data]="data" [series]="series"
      ></z-boxplot-chart>
      <z-boxplot-chart
        heading="Compact Quartile Plot"
        description="Boxplot with legend visible vs compact distribution view."
        xKey="service" minKey="min" q1Key="q1" medianKey="median" q3Key="q3" maxKey="max" [hideLegend]="true" [data]="data" [series]="series"
      ></z-boxplot-chart>
    </z-stack>
  `,
})
export class BoxplotChartVariants {
  readonly data = boxplotData;
  readonly series = boxplotSeries;
}

```


================================================================================
# COMPONENT: BREADCRUMB
================================================================================

## Documentation

# breadcrumb — Angular

Processed requirements of [`<z-breadcrumb>`](../../../../../requirements/04-components/navigation/breadcrumb.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-breadcrumb>
  <z-breadcrumb-item href="/">Home</z-breadcrumb-item>
  <z-breadcrumb-item>Jacket</z-breadcrumb-item>
</z-breadcrumb>
```

## Binding

No model event. Links are real `<a href>` inside the items: for client-side routing listen to `click` on the item, call `preventDefault()` and navigate with the router.

## Events

None (native `click` on the links).

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `breadcrumb-basic.ts` | D-1 Default |
| `collapsed` | `breadcrumb-collapsed.ts` | D-14 Long content, D-15 Keyboard-only |
| `separator` | `breadcrumb-separator.ts` | D-18 Customization, D-11 RTL |
| `sizes` | `breadcrumb-sizes.ts` | D-5 Sizes |
| `spa-routing` | `breadcrumb-spa-routing.ts` | D-23 SPA routing (collapsed "…" entries, app link in an item) |


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBreadcrumb, ZBreadcrumbItem } from '@zelviora/angular';

@Component({
  selector: 'demo-breadcrumb-basic',
  imports: [ZBreadcrumb, ZBreadcrumbItem],
  template: `
    <z-breadcrumb>
      <z-breadcrumb-item href="#home">Home</z-breadcrumb-item>
      <z-breadcrumb-item href="#products">Products</z-breadcrumb-item>
      <z-breadcrumb-item>Jackets</z-breadcrumb-item>
    </z-breadcrumb>
  `,
})
export class BreadcrumbBasic {}

```

### Case: collapsed

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBreadcrumb, ZBreadcrumbItem } from '@zelviora/angular';

@Component({
  selector: 'demo-breadcrumb-collapsed',
  imports: [ZBreadcrumb, ZBreadcrumbItem],
  template: `
    <z-breadcrumb [maxItems]="4">
      @for (label of levels; track label; let i = $index) {
        <z-breadcrumb-item [href]="'#level-' + (i + 1)">{{ label }}</z-breadcrumb-item>
      }
      <z-breadcrumb-item>Water-resistant hooded windbreaker, moss green</z-breadcrumb-item>
    </z-breadcrumb>
  `,
})
export class BreadcrumbCollapsed {
  readonly levels = ['Home', 'Fashion', 'Men', 'Tops', 'Jackets', 'Windbreakers', 'Autumn-winter collection 2026'];
}

```

### Case: separator

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBreadcrumb, ZBreadcrumbItem, ZIcon, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-breadcrumb-separator',
  imports: [ZBreadcrumb, ZBreadcrumbItem, ZIcon, ZStack],
  template: `
    <z-stack gap="md">
      <z-breadcrumb label="Path with chevrons">
        <z-icon slot="separator" name="chevron_right"></z-icon>
        <z-breadcrumb-item href="#home">Home</z-breadcrumb-item>
        <z-breadcrumb-item href="#settings">Settings</z-breadcrumb-item>
        <z-breadcrumb-item>Notifications</z-breadcrumb-item>
      </z-breadcrumb>
      <div dir="rtl" lang="ar">
        <z-breadcrumb label="مسار التنقل">
          <z-icon slot="separator" name="chevron_right"></z-icon>
          <z-breadcrumb-item href="#home">الرئيسية</z-breadcrumb-item>
          <z-breadcrumb-item href="#settings">الإعدادات</z-breadcrumb-item>
          <z-breadcrumb-item>الإشعارات</z-breadcrumb-item>
        </z-breadcrumb>
      </div>
    </z-stack>
  `,
})
export class BreadcrumbSeparator {}

```

### Case: sizes

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBreadcrumb, ZBreadcrumbItem, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-breadcrumb-sizes',
  imports: [ZBreadcrumb, ZBreadcrumbItem, ZStack],
  template: `
    <z-stack gap="md">
      @for (size of sizes; track size) {
        <z-breadcrumb [size]="size" [label]="'Breadcrumb ' + size">
          <z-breadcrumb-item href="#home">Home</z-breadcrumb-item>
          <z-breadcrumb-item href="#orders">Orders</z-breadcrumb-item>
          <z-breadcrumb-item>Order #1024</z-breadcrumb-item>
        </z-breadcrumb>
      }
    </z-stack>
  `,
})
export class BreadcrumbSizes {
  readonly sizes = ['sm', 'md', 'lg'] as const;
}

```

### Case: spa-routing

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBreadcrumb, ZBreadcrumbItem } from '@zelviora/angular';

// SPA routing (ADR-026): one (zNavigate) listener routes with the app router; Ctrl/⌘-click still opens a new tab.
@Component({
  selector: 'demo-breadcrumb-spa-routing',
  imports: [ZBreadcrumb, ZBreadcrumbItem],
  template: `
    <z-breadcrumb [maxItems]="3" (zNavigate)="navigate($event)">
      <z-breadcrumb-item><a href="#/" (click)="appLink($event)">Home</a></z-breadcrumb-item>
      <z-breadcrumb-item href="#/products">Products</z-breadcrumb-item>
      <z-breadcrumb-item href="#/products/shoes">Shoes</z-breadcrumb-item>
      <z-breadcrumb-item href="#/products/shoes/running">Running</z-breadcrumb-item>
      <z-breadcrumb-item>Trail runner 2</z-breadcrumb-item>
    </z-breadcrumb>
    <p aria-live="polite">Current route: <code>{{ route }}</code></p>
  `,
})
export class BreadcrumbSpaRouting {
  route = '#/products/shoes/running';

  /** One zNavigate listener calls the app router (stand-in for `Router.navigateByUrl`). */
  navigate(e: Event): void {
    const ev = e as CustomEvent<{ href: string }>;
    ev.preventDefault();
    this.route = ev.detail.href; // this.router.navigateByUrl(...)
  }

  /** Stand-in for `<a routerLink>`: an `<a href>` that routes on a plain click. */
  appLink(e: MouseEvent): void {
    if (e.ctrlKey || e.metaKey || e.shiftKey || e.button !== 0) return;
    e.preventDefault();
    this.route = (e.currentTarget as HTMLAnchorElement).getAttribute('href')!;
  }
}

```


================================================================================
# COMPONENT: BUBBLE
================================================================================

## Documentation

# Bubble — Angular

Processed requirements of [`<z-bubble>`](../../../../../requirements/04-components/data-display/bubble.md) for Angular (`@zelviora/angular`).

## Usage

```ts
import { Component } from '@angular/core';
import { ZAvatar, ZBubble } from '@zelviora/angular';

@Component({
  selector: 'app-root',
  imports: [ZAvatar, ZBubble],
  template: `
    <z-bubble author="Sarah" time="10:30 AM" align="start" variant="secondary">
      <z-avatar slot="avatar" name="Sarah" size="sm"></z-avatar>
      Hello! How can I assist you today?
    </z-bubble>
  `,
})
export class AppComponent {}
```

## Demo mapping

| `type` | File | Description |
|---|---|---|
| `basic` | `bubble-basic.ts` | Standard incoming and outgoing messages with avatars, timestamps, and delivery statuses. |
| `variants` | `bubble-variants.ts` | 8 visual variants including default, primary, secondary, muted, tinted, outline, ghost, and destructive. |
| `group` | `bubble-group.ts` | Grouped bubbles with continuous stacking and joined corner radii. |
| `reactions` | `bubble-reactions.ts` | Reactions toolbar anchored to the top or bottom edge of a bubble. |
| `actions` | `bubble-actions.ts` | Quick action toolbars (Copy, Reply, Forward) attached beside the bubble. |
| `typing` | `bubble-typing.ts` | Animated typing indicator wave for loading states. |
| `interactive` | `bubble-interactive.ts` | Clickable button bubble or link bubble emitting `zNavigate`. |


## Examples & Implementation

### Case: actions

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZAvatar, ZBubble, ZButton, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-bubble-actions',
  imports: [ZAvatar, ZBubble, ZButton, ZStack],
  template: `
    <z-stack orientation="vertical" gap="md" class="demo-narrow">
      <z-bubble
        author="Assistant"
        time="02:30 PM"
        align="start"
        variant="secondary"
      >
        <z-avatar slot="avatar" name="Assistant" size="sm"></z-avatar>
        Here is the command to install the package dependencies:
        <br />
        <code>pnpm add @zelviora/angular @zelviora/icons</code>
        <z-stack slot="actions" orientation="horizontal" gap="xs">
          <z-button size="sm" variant="ghost" tone="neutral">Copy</z-button>
          <z-button size="sm" variant="ghost" tone="neutral">Reply</z-button>
        </z-stack>
      </z-bubble>
    </z-stack>
  `,
})
export class BubbleActions {}

```

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZAvatar, ZBubble, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-bubble-basic',
  imports: [ZAvatar, ZBubble, ZStack],
  template: `
    <z-stack orientation="vertical" gap="md" class="demo-narrow">
      <z-bubble
        author="Sarah Connor"
        time="10:30 AM"
        align="start"
        variant="secondary"
      >
        <z-avatar slot="avatar" name="Sarah Connor" size="sm"></z-avatar>
        Hi there! Have you reviewed the final design proposal for the messaging interface?
      </z-bubble>

      <z-bubble
        time="10:32 AM"
        align="end"
        variant="primary"
        status="read"
      >
        Yes, looks fantastic! I especially like the reaction pill layout and smooth corner radii.
      </z-bubble>

      <z-bubble
        author="Sarah Connor"
        time="10:33 AM"
        align="start"
        variant="secondary"
      >
        <z-avatar slot="avatar" name="Sarah Connor" size="sm"></z-avatar>
        Awesome. I will push the latest build to staging right away!
      </z-bubble>
    </z-stack>
  `,
})
export class BubbleBasic {}

```

### Case: group

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZAvatar, ZBubble, ZBubbleGroup, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-bubble-group',
  imports: [ZAvatar, ZBubble, ZBubbleGroup, ZStack],
  template: `
    <z-stack orientation="vertical" gap="lg" class="demo-narrow">
      <z-stack orientation="horizontal" gap="sm">
        <z-avatar name="Marcus Reed" size="sm"></z-avatar>
        <z-bubble-group align="start" variant="secondary" label="Messages from Marcus">
          <z-bubble author="Marcus Reed">
            Good morning team! We just released the latest component sprint.
          </z-bubble>
          <z-bubble>
            Please test the message bubble component across different viewport widths.
          </z-bubble>
          <z-bubble time="09:15 AM">
            Let me know if you run into any edge cases with reactions or long code snippets.
          </z-bubble>
        </z-bubble-group>
      </z-stack>

      <z-bubble-group align="end" variant="primary" label="My outgoing messages">
        <z-bubble>
          On it right now!
        </z-bubble>
        <z-bubble time="09:16 AM" status="read">
          Tested the corner radius join in groups and it looks pixel perfect.
        </z-bubble>
      </z-bubble-group>
    </z-stack>
  `,
})
export class BubbleGroup {}

```

### Case: interactive

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZAvatar, ZBubble, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-bubble-interactive',
  imports: [ZAvatar, ZBubble, ZStack],
  template: `
    <z-stack orientation="vertical" gap="md" class="demo-narrow">
      <z-bubble
        author="System Prompt"
        align="start"
        variant="tinted"
        [interactive]="true"
        (click)="onClick()"
      >
        <z-avatar slot="avatar" name="System Prompt" size="sm"></z-avatar>
        Click here to regenerate response with higher temperature.
      </z-bubble>

      <z-bubble
        author="Documentation Bot"
        time="03:00 PM"
        align="start"
        variant="outline"
        href="#/components/bubble"
      >
        <z-avatar slot="avatar" name="Doc Bot" size="sm"></z-avatar>
        View full Bubble documentation and design token reference.
      </z-bubble>
    </z-stack>
  `,
})
export class BubbleInteractive {
  onClick() {
    alert('Bubble action clicked!');
  }
}

```

### Case: reactions

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZAvatar, ZBubble, ZBubbleReactions, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-bubble-reactions',
  imports: [ZAvatar, ZBubble, ZBubbleReactions, ZStack],
  template: `
    <z-stack orientation="vertical" gap="lg" class="demo-narrow">
      <z-bubble
        author="Evelyn Carter"
        time="11:45 AM"
        align="start"
        variant="secondary"
      >
        <z-avatar slot="avatar" name="Evelyn Carter" size="sm"></z-avatar>
        We just hit 10,000 active developers using the design system!
        <z-bubble-reactions slot="reactions" side="bottom" align="start">
          <button type="button">🔥 14</button>
          <button type="button">❤️ 9</button>
          <button type="button">👏 6</button>
        </z-bubble-reactions>
      </z-bubble>

      <z-bubble
        time="11:47 AM"
        align="end"
        variant="primary"
        status="read"
      >
        Huge milestone for the entire engineering organization! Congrats everyone!
        <z-bubble-reactions slot="reactions" side="bottom" align="end">
          <button type="button">🙌 5</button>
        </z-bubble-reactions>
      </z-bubble>
    </z-stack>
  `,
})
export class BubbleReactions {}

```

### Case: typing

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZAvatar, ZBubble, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-bubble-typing',
  imports: [ZAvatar, ZBubble, ZStack],
  template: `
    <z-stack orientation="vertical" gap="md" class="demo-narrow">
      <z-bubble
        author="Assistant"
        align="start"
        variant="secondary"
        [loading]="true"
      >
        <z-avatar slot="avatar" name="Assistant" size="sm"></z-avatar>
      </z-bubble>
    </z-stack>
  `,
})
export class BubbleTyping {}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBubble, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-bubble-variants',
  imports: [ZBubble, ZStack],
  template: `
    <z-stack orientation="vertical" gap="sm" class="demo-narrow">
      <z-bubble variant="default" author="Default variant">
        Neutral subtle border with clean elevated background.
      </z-bubble>

      <z-bubble variant="primary" align="end" author="Primary variant">
        Primary brand tone, high contrast for outgoing user messages.
      </z-bubble>

      <z-bubble variant="secondary" author="Secondary variant">
        Solid soft fill ideal for incoming peer messages.
      </z-bubble>

      <z-bubble variant="muted" author="Muted variant">
        Subdued background for system notices or AI thinking blocks.
      </z-bubble>

      <z-bubble variant="tinted" author="Tinted variant">
        Light primary hue accent for highlighted recommendations.
      </z-bubble>

      <z-bubble variant="outline" author="Outline variant">
        Crisp 1px border with transparent background.
      </z-bubble>

      <z-bubble variant="ghost" author="Ghost variant">
        Border-less transparent bubble, useful for continuous text streams.
      </z-bubble>

      <z-bubble variant="destructive" align="end" author="Destructive variant">
        Alert tone for failed actions or critical notifications.
      </z-bubble>
    </z-stack>
  `,
})
export class BubbleVariants {}

```


================================================================================
# COMPONENT: BUTTON
================================================================================

## Documentation

# button — Angular

Processed requirements of [`<z-button>`](../../../../../requirements/04-components/base/button.md) for Angular (`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component, signal } from '@angular/core';
import { ZButton, ZIcon } from '@zelviora/angular';

@Component({
  selector: 'app-actions',
  imports: [ZButton, ZIcon],
  template: `
    <z-button (click)="save()">Save</z-button>
    <z-button type="submit" [loading]="pending()">Send</z-button>
    <z-button variant="outline" tone="neutral">
      <z-icon slot="icon-start" name="close"></z-icon>
      Discard
    </z-button>
  `,
})
export class Actions { readonly pending = signal(false); save() {} }
```

`type` defaults to `button` (not `submit` as on a native `<button>`): set `type="submit"` explicitly in forms.

## Binding

No value accessor (not a form value). Form inputs (`type`, `name`, `value`, `form`, `formAction`, `formMethod`,
`[formNoValidate]`, `formTarget`, `formEnctype`) behave like a native submit button; the submitter `name`/`value`
reach the form data.

## Events

Native `(click)`, `(focus)`, `(blur)`. `click` is blocked while `disabled` or `loading`, and when a parent `fieldset` is disabled.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `button-default.ts` | D-1 Default |
| `variants` | `button-variants.ts` | D-3 Variants |
| `tones` | `button-tones.ts` | D-4 Tones (tone × solid/soft/outline/ghost) |
| `sizes` | `button-sizes.ts` | D-5 Sizes, D-14 long label with `block` |
| `states` | `button-states.ts` | D-6 States (disabled, loading), D-7 Disabled (every variant, `fieldset[disabled]`), D-20 loading |
| `loading` | `button-loading.ts` | D-9 loading driven from outside (2 s) |
| `form` | `button-form.ts` | D-10 In form (submit, reset, submitter `name`/`value`, `formNoValidate`) |
| `link` | `button-link.ts` | D-21 As link (`href`, `target="_blank"`, disabled link) |
| `icons` | `button-icons.ts` | D-22 With icons (icon-start, icon-end, spinner replaces the icon) |
| `spa-routing` | `button-spa-routing.ts` | D-23 SPA routing |

Not covered here: D-2 playground, D-8 error (not applicable), D-11 RTL and D-16 density (see the config-provider
demos), D-12 dark (the docs theme switch), D-13 brand showcase, D-15 keyboard-only, D-17 composition (see the stack
and dialog demos), D-18 customization, D-19 i18n.

## Differences

- Boolean and number props are bound with `[prop]="…"` (`[loading]="true"`), so the value reaches the element with its type.
- The form demo keeps a native `<form>` (FormsModule not imported) so the submitter reaches `FormData`; with FormsModule, `NgForm` takes over the submit (`(ngSubmit)`).
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton } from '@zelviora/angular';

@Component({
  selector: 'demo-button-default',
  imports: [ZButton],
  template: `<z-button (click)="save()">Save</z-button>`,
})
export class ButtonDefault {
  save() {
    console.log('saved');
  }
}

```

### Case: form

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZField, ZInput, ZStack } from '@zelviora/angular';

/**
 * Submit, reset, a submitter with `name`/`value`, and `formNoValidate` that skips the required field.
 * A native form (FormsModule is not imported, so Angular does not take over the submit).
 */
@Component({
  selector: 'demo-button-form',
  imports: [ZButton, ZField, ZInput, ZStack],
  template: `
    <form class="demo-narrow" (submit)="submit($event)" (reset)="sent.set('')">
      <z-stack>
        <z-field label="Title" [required]="true">
          <z-input name="title" [required]="true"></z-input>
        </z-field>
        <z-stack orientation="horizontal" align-items="center" gap="sm" [wrap]="true">
          <z-button type="submit" name="action" value="publish">Publish</z-button>
          <z-button type="submit" name="action" value="draft" variant="soft" [formNoValidate]="true">Save draft</z-button>
          <z-button type="reset" variant="outline" tone="neutral">Reset</z-button>
        </z-stack>
        <p>FormData: {{ sent() || '(not submitted)' }}</p>
      </z-stack>
    </form>
  `,
})
export class ButtonForm {
  readonly sent = signal('');

  submit(e: Event) {
    e.preventDefault();
    const data = new FormData(e.currentTarget as HTMLFormElement, (e as SubmitEvent).submitter);
    this.sent.set(JSON.stringify(Object.fromEntries(data)));
  }
}

```

### Case: icons

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZIcon, ZStack } from '@zelviora/angular';

/** Icons go in the `icon-start` / `icon-end` slots; while loading, the spinner takes the place of the start icon. */
@Component({
  selector: 'demo-button-icons',
  imports: [ZButton, ZIcon, ZStack],
  template: `
    <z-stack orientation="horizontal" align-items="center" gap="md" [wrap]="true">
      <z-button variant="outline" tone="neutral">
        <z-icon slot="icon-start" name="close"></z-icon>
        Discard
      </z-button>
      <z-button>
        Next step
        <z-icon slot="icon-end" name="chevron_right"></z-icon>
      </z-button>
      <z-button variant="soft" [loading]="loading()" (click)="next()">
        <z-icon slot="icon-start" name="chevron_right"></z-icon>
        Continue
      </z-button>
    </z-stack>
  `,
})
export class ButtonIcons {
  readonly loading = signal(false);

  next() {
    this.loading.set(true);
    setTimeout(() => this.loading.set(false), 2000);
  }
}

```

### Case: link

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZStack } from '@zelviora/angular';

/** With `href` the button renders an `<a>`; `_blank` adds `rel="noopener noreferrer"`. A disabled link is not focusable. */
@Component({
  selector: 'demo-button-link',
  imports: [ZButton, ZStack],
  template: `
    <z-stack orientation="horizontal" align-items="center" gap="md" [wrap]="true">
      <z-button href="#link">Go to this section</z-button>
      <z-button href="https://example.com" target="_blank" variant="outline">Open example.com</z-button>
      <z-button href="#link" variant="soft" [disabled]="true">Unavailable</z-button>
    </z-stack>
  `,
})
export class ButtonLink {}

```

### Case: loading

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton } from '@zelviora/angular';

/** Loading driven from outside: the click starts a 2 s task; the button keeps its size and focus meanwhile. */
@Component({
  selector: 'demo-button-loading',
  imports: [ZButton],
  template: `<z-button [loading]="loading()" (click)="save()">Save changes</z-button>`,
})
export class ButtonLoading {
  readonly loading = signal(false);

  save() {
    this.loading.set(true);
    setTimeout(() => this.loading.set(false), 2000);
  }
}

```

### Case: sizes

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZStack } from '@zelviora/angular';

/** Without `size` the button follows the nearest config-provider, then `md`; `block` takes the full width. */
@Component({
  selector: 'demo-button-sizes',
  imports: [ZButton, ZStack],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" align-items="center" gap="md" [wrap]="true">
        <z-button size="sm">Small</z-button>
        <z-button size="md">Medium</z-button>
        <z-button size="lg">Large</z-button>
      </z-stack>
      <z-button [block]="true" variant="soft">Export the quarterly revenue report by branch</z-button>
    </z-stack>
  `,
})
export class ButtonSizes {}

```

### Case: spa-routing

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton } from '@zelviora/angular';

// SPA routing (ADR-026): one (zNavigate) listener routes with the app router; Ctrl/⌘-click still opens a new tab.
@Component({
  selector: 'demo-button-spa-routing',
  imports: [ZButton],
  template: `
    <z-button href="#/orders/new" (zNavigate)="navigate($event)">New order</z-button>
    <p aria-live="polite">Current route: <code>{{ route }}</code></p>
  `,
})
export class ButtonSpaRouting {
  route = '#/home';

  /** One zNavigate listener calls the app router (stand-in for `Router.navigateByUrl`). */
  navigate(e: Event): void {
    const ev = e as CustomEvent<{ href: string }>;
    ev.preventDefault();
    this.route = ev.detail.href; // this.router.navigateByUrl(...)
  }
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZStack } from '@zelviora/angular';

const VARIANTS = ['solid', 'soft', 'outline', 'ghost', 'dashed', 'link'] as const;

/** Disabled in every variant, loading, and disabled through a native `fieldset[disabled]`. */
@Component({
  selector: 'demo-button-states',
  imports: [ZButton, ZStack],
  template: `
    <z-stack gap="lg">
      <z-stack orientation="horizontal" align-items="center" gap="sm" [wrap]="true">
        @for (variant of variants; track variant) {
          <z-button [variant]="variant" [disabled]="true">Disabled</z-button>
        }
      </z-stack>
      <z-stack orientation="horizontal" align-items="center" gap="sm" [wrap]="true">
        <z-button [loading]="true">Saving</z-button>
        <z-button variant="outline" tone="neutral" [loading]="true" loadingLabel="Exporting the report">Export</z-button>
      </z-stack>
      <fieldset disabled>
        <legend>Fieldset disabled</legend>
        <z-stack orientation="horizontal" align-items="center" gap="sm" [wrap]="true">
          <z-button>Save</z-button>
          <z-button variant="outline" tone="neutral">Cancel</z-button>
        </z-stack>
      </fieldset>
    </z-stack>
  `,
})
export class ButtonStates {
  readonly variants = VARIANTS;
}

```

### Case: tones

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZStack } from '@zelviora/angular';

const TONES = ['primary', 'neutral', 'success', 'warning', 'destructive', 'info'] as const;
const VARIANTS = ['solid', 'soft', 'outline', 'ghost'] as const;

/** One row per variant, one button per tone. */
@Component({
  selector: 'demo-button-tones',
  imports: [ZButton, ZStack],
  template: `
    <z-stack gap="sm">
      @for (variant of variants; track variant) {
        <z-stack orientation="horizontal" align-items="center" gap="sm" [wrap]="true">
          @for (tone of tones; track tone) {
            <z-button [variant]="variant" [tone]="tone">{{ tone[0].toUpperCase() + tone.slice(1) }}</z-button>
          }
        </z-stack>
      }
    </z-stack>
  `,
})
export class ButtonTones {
  readonly tones = TONES;
  readonly variants = VARIANTS;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZStack } from '@zelviora/angular';

const VARIANTS = ['solid', 'soft', 'outline', 'ghost', 'dashed', 'link'] as const;

@Component({
  selector: 'demo-button-variants',
  imports: [ZButton, ZStack],
  template: `
    <z-stack orientation="horizontal" align-items="center" gap="md" [wrap]="true">
      @for (variant of variants; track variant) {
        <z-button [variant]="variant">{{ variant[0].toUpperCase() + variant.slice(1) }}</z-button>
      }
    </z-stack>
  `,
})
export class ButtonVariants {
  readonly variants = VARIANTS;
}

```


================================================================================
# COMPONENT: BUTTON-GROUP
================================================================================

## Documentation

# button-group — Angular

Processed requirements of [`<z-button-group>`](../../../../../requirements/04-components/base/button-group.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-button-group label="Pagination" variant="outline">
  <z-button>Previous</z-button>
  <z-button>Next</z-button>
</z-button-group>
```

## Binding

No model event. The group writes internal `data-z-*` attributes on its buttons (position, inherited size and variant); a prop set on a button always wins.

## Events

None.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `button-group-basic.ts` | D-1 Default |
| `variants` | `button-group-variants.ts` | D-3 Variants, D-5 Sizes |
| `vertical` | `button-group-vertical.ts` | D-21 Vertical, D-7 Disabled |
| `split` | `button-group-split.ts` | D-17 Composition |


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZButtonGroup } from '@zelviora/angular';

@Component({
  selector: 'demo-button-group-basic',
  imports: [ZButton, ZButtonGroup],
  template: `
    <z-button-group label="Text alignment" variant="outline">
      <z-button tone="neutral">Left</z-button>
      <z-button tone="neutral">Center</z-button>
      <z-button tone="neutral">Right</z-button>
    </z-button-group>
  `,
})
export class ButtonGroupBasic {}

```

### Case: split

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZButtonGroup, ZDropdownMenu, ZIcon, ZIconButton, ZMenuItem, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-button-group-split',
  imports: [ZButton, ZButtonGroup, ZDropdownMenu, ZIcon, ZIconButton, ZMenuItem, ZStack],
  template: `
    <z-stack orientation="horizontal" align-items="center" gap="md" [wrap]="true">
      <z-button-group label="Save options">
        <z-button (click)="last.set('save')">Save</z-button>
        <z-dropdown-menu (zSelect)="last.set($event.detail.value)">
          <z-icon-button slot="trigger" variant="solid" tone="primary" label="More save options">
            <z-icon name="chevron_right"></z-icon>
          </z-icon-button>
          <z-menu-item value="save-as">Save as…</z-menu-item>
          <z-menu-item value="save-copy">Save a copy</z-menu-item>
        </z-dropdown-menu>
      </z-button-group>
      <span>{{ last() ? 'Last action: ' + last() : 'No action yet' }}</span>
    </z-stack>
  `,
})
export class ButtonGroupSplit {
  readonly last = signal('');
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZButtonGroup, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-button-group-variants',
  imports: [ZButton, ZButtonGroup, ZStack],
  template: `
    <z-stack gap="md">
      @for (size of sizes; track size) {
        <z-button-group [label]="'Pagination ' + size" [size]="size" variant="outline">
          <z-button tone="neutral">Previous</z-button>
          <z-button tone="neutral">1</z-button>
          <z-button tone="neutral">2</z-button>
          <z-button tone="neutral">Next</z-button>
        </z-button-group>
      }
      <z-button-group label="Detached actions" [detached]="true" variant="soft">
        <z-button>Save</z-button>
        <z-button tone="neutral">Cancel</z-button>
        <z-button variant="ghost" tone="destructive">Delete</z-button>
      </z-button-group>
    </z-stack>
  `,
})
export class ButtonGroupVariants {
  readonly sizes = ['sm', 'md', 'lg'] as const;
}

```

### Case: vertical

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZButtonGroup } from '@zelviora/angular';

@Component({
  selector: 'demo-button-group-vertical',
  imports: [ZButton, ZButtonGroup],
  template: `
    <z-button-group label="Zoom" orientation="vertical" variant="outline">
      <z-button tone="neutral">Zoom in</z-button>
      <z-button tone="neutral" [disabled]="true">Reset</z-button>
      <z-button tone="neutral">Zoom out</z-button>
    </z-button-group>
  `,
})
export class ButtonGroupVertical {}

```


================================================================================
# COMPONENT: CALENDAR
================================================================================

## Documentation

# calendar — Angular

Processed requirements of [`<z-calendar>`](../../../../../requirements/04-components/data-display/calendar.md) for Angular
(`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component, signal } from '@angular/core';
import { ZCalendar } from '@zelviora/angular';

@Component({
  selector: 'app-delivery',
  imports: [ZCalendar],
  template: `<z-calendar label="Delivery date" [value]="day()" (zChange)="day.set($event.detail.value)"></z-calendar>`,
})
export class Delivery { readonly day = signal<string | string[] | null>(null); }
```

## Binding

The calendar is not a form control (spec §5): there is no value accessor; bind `[value]` + `(zChange)` (`{ value }`).
Use the date picker for a form value.

Other events: `(zMonthChange)` (`{ month: 'YYYY-MM' }`, bind `[month]`), `(zViewChange)` (`{ view }`). Function inputs:
`[isDateUnavailable]`, `[getDayDescription]`.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `calendar-default.ts` | D-1 Default, D-15 Keyboard-only |
| `variants` | `calendar-variants.ts` | D-3 Variants (selectionMode single / multiple / range / none) |
| `sizes` | `calendar-sizes.ts` | D-5 Sizes, D-16 Density |
| `states` | `calendar-states.ts` | D-6 States (today, range, outside, unavailable by min / max), D-7 Disabled / readonly |
| `controlled` | `calendar-controlled.ts` | D-9 Controlled (`value` + `month`) |
| `months` | `calendar-months.ts` | D-14 Long content (3 months, week numbers) |
| `composition` | `calendar-composition.ts` | D-17 Composition (card, `day:*` slots, `getDayDescription`, footer) |
| `customization` | `calendar-customization.ts` | D-18 Customization (tokens, `::part(day-range-middle)`) |
| `i18n` | `calendar-i18n.ts` | D-19 i18n (vi, en-US), D-11 RTL (ar-EG) |
| `unavailable` | `calendar-unavailable.ts` | D-21 Unavailable days (weekends + holiday) |

D-2 Playground, D-12 Dark and D-13 Brand showcase come from the docs site (theme and brand switchers); D-4 Tones, D-8
Error, D-10 In form and D-20 Empty / loading do not apply.

Customization rule used by the `customization` demo (`demo.css`):

```css
.demo-calendar-brand {
  --z-calendar-cell-radius: var(--z-radius-full);
  --z-calendar-selected-bg: var(--z-color-success);
  --z-calendar-selected-fg: var(--z-color-success-foreground);
  --z-calendar-today-ring: var(--z-color-success-text);
}
.demo-calendar-brand::part(day-range-middle) {
  font-weight: var(--z-font-weight-semibold);
}
```

## Differences

- The `day:<YYYY-MM-DD>` slots are decorative (`aria-hidden`): give the same information through `getDayDescription`.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: composition

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZCalendar, ZCard } from '@zelviora/angular';

const EVENTS: Record<string, number> = { '2026-10-05': 2, '2026-10-12': 1, '2026-10-21': 3 };

/** In a card: event dots in the `day:<date>` slots (decorative), the same count read through `getDayDescription`. */
@Component({
  selector: 'demo-calendar-composition',
  imports: [ZButton, ZCalendar, ZCard],
  template: `
    <z-card heading="Meetings" class="demo-narrow">
      <z-calendar label="Meetings" today="2026-10-02" [getDayDescription]="describe">
        @for (d of days; track d) {
          <span [attr.slot]="'day:' + d" class="demo-calendar-dot"></span>
        }
        <z-button slot="footer" size="sm" variant="ghost">Today</z-button>
      </z-calendar>
    </z-card>
  `,
})
export class CalendarComposition {
  readonly days = Object.keys(EVENTS);
  readonly describe = (d: string) => (EVENTS[d] ? `${EVENTS[d]} ${EVENTS[d] === 1 ? 'meeting' : 'meetings'}` : undefined);
}

```

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZCalendar, ZStack } from '@zelviora/angular';

/** The app owns `value` and `month`: buttons set them from code (no event); the log lists user changes. */
@Component({
  selector: 'demo-calendar-controlled',
  imports: [ZButton, ZCalendar, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-calendar
        label="Deadline"
       
        today="2026-10-02"
        [value]="value()"
        [month]="month()"
        (zChange)="value.set($event.detail.value); add('zChange ' + $event.detail.value)"
        (zMonthChange)="month.set($event.detail.month); add('zMonthChange ' + $event.detail.month)"
        (zViewChange)="add('zViewChange ' + $event.detail.view)"
      ></z-calendar>
      <z-stack orientation="horizontal" gap="sm" [wrap]="true">
        <z-button variant="outline" tone="neutral" (click)="value.set('2026-12-31'); month.set('2026-12')">Set Dec 31, 2026</z-button>
        <z-button variant="outline" tone="neutral" (click)="month.set('2027-01')">Show Jan 2027</z-button>
        <z-button variant="outline" tone="neutral" (click)="value.set(null)">Clear</z-button>
      </z-stack>
      <span>Value: {{ value() ?? 'null' }} · month: {{ month() }}</span>
      <output>{{ log().join(' · ') }}</output>
    </z-stack>
  `,
})
export class CalendarControlled {
  readonly value = signal<string | string[] | null>('2026-10-15');
  readonly month = signal('2026-10');
  readonly log = signal<string[]>([]);

  add(line: string) {
    this.log.update((l) => [line, ...l].slice(0, 5));
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCalendar } from '@zelviora/angular';

/** Calendar tokens and the day state parts (`::part(day-selected)`): see the `demo-calendar-brand` rule in README. */
@Component({
  selector: 'demo-calendar-customization',
  imports: [ZCalendar],
  template: `
    <z-calendar class="demo-calendar-brand" label="Appointment date" today="2026-10-02" selectionMode="range" [value]="range"></z-calendar>
  `,
})
export class CalendarCustomization {
  readonly range = ['2026-10-12', '2026-10-16'];
}

```

### Case: default

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZCalendar, ZStack } from '@zelviora/angular';

/**
 * A standalone month grid: arrows move by day / week, PageUp/PageDown by month, Enter selects; "today" is fixed.
 * Not a form control: bind `[value]` and `(zChange)` (no value accessor).
 */
@Component({
  selector: 'demo-calendar-default',
  imports: [ZCalendar, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-calendar label="Delivery date" today="2026-10-02" [value]="value()" (zChange)="value.set($event.detail.value)"></z-calendar>
      <span>Value: {{ value() ?? 'null' }}</span>
    </z-stack>
  `,
})
export class CalendarDefault {
  readonly value = signal<string | string[] | null>('2026-10-15');
}

```

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCalendar, ZGrid } from '@zelviora/angular';

/** Month and weekday names and the first day of the week follow the locale: vi (Monday), en-US (Sunday), Arabic in RTL. */
@Component({
  selector: 'demo-calendar-i18n',
  imports: [ZCalendar, ZGrid],
  template: `
    <z-grid columns="1 md:3" gap="lg">
      <z-calendar label="Tiếng Việt" locale="vi" today="2026-10-02" value="2026-10-15"></z-calendar>
      <z-calendar label="English (US)" locale="en-US" today="2026-10-02" value="2026-10-15"></z-calendar>
      <div dir="rtl" lang="ar-EG">
        <z-calendar label="العربية" locale="ar-EG" today="2026-10-02" value="2026-10-15"></z-calendar>
      </div>
    </z-grid>
  `,
})
export class CalendarI18n {}

```

### Case: months

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCalendar } from '@zelviora/angular';

/** Three months side by side with ISO week numbers, picking a range across months. */
@Component({
  selector: 'demo-calendar-months',
  imports: [ZCalendar],
  template: `
    <z-calendar label="Holiday" today="2026-10-02" selectionMode="range" [numberOfMonths]="3" [weekNumbers]="true" [value]="range"></z-calendar>
  `,
})
export class CalendarMonths {
  readonly range = ['2026-10-26', '2026-11-04'];
}

```

### Case: sizes

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCalendar, ZGrid } from '@zelviora/angular';

/** Cell sizes follow the control heights: small, medium (default) and large. */
@Component({
  selector: 'demo-calendar-sizes',
  imports: [ZCalendar, ZGrid],
  template: `
    <z-grid columns="1 md:3" gap="lg">
      <z-calendar label="Small" size="sm" today="2026-10-02" value="2026-10-15"></z-calendar>
      <z-calendar label="Medium" size="md" today="2026-10-02" value="2026-10-15"></z-calendar>
      <z-calendar label="Large" size="lg" today="2026-10-02" value="2026-10-15"></z-calendar>
    </z-grid>
  `,
})
export class CalendarSizes {}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCalendar, ZGrid } from '@zelviora/angular';

/** Today, selected range, outside days, unavailable days (min / max), outside days hidden, disabled and readonly. */
@Component({
  selector: 'demo-calendar-states',
  imports: [ZCalendar, ZGrid],
  template: `
    <z-grid columns="1 sm:2" gap="lg">
      <z-calendar label="Range, min 05 / max 25" today="2026-10-02" selectionMode="range" [value]="range" min="2026-10-05" max="2026-10-25"></z-calendar>
      <z-calendar label="Outside days hidden" today="2026-10-02" value="2026-10-02" [hideOutsideDays]="true"></z-calendar>
      <z-calendar label="Disabled" today="2026-10-02" value="2026-10-15" [disabled]="true"></z-calendar>
      <z-calendar label="Readonly" today="2026-10-02" value="2026-10-15" [readonly]="true"></z-calendar>
    </z-grid>
  `,
})
export class CalendarStates {
  readonly range = ['2026-10-08', '2026-10-14'];
}

```

### Case: unavailable

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCalendar } from '@zelviora/angular';

const HOLIDAYS = new Set(['2026-09-02', '2026-10-20']);
/** Day of the week of a calendar date (Sakamoto), 0 = Sunday: no Date, no time zone. */
const T = [0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4];
const isClosed = (date: string) => {
  const [y0, m, d] = date.split('-').map(Number) as [number, number, number];
  const y = m < 3 ? y0 - 1 : y0;
  const day = (y + Math.floor(y / 4) - Math.floor(y / 100) + Math.floor(y / 400) + T[m - 1]! + d) % 7;
  return day === 0 || day === 6 || HOLIDAYS.has(date);
};

/** Weekends and holidays are unavailable: focusable, read as unavailable, not selectable. */
@Component({
  selector: 'demo-calendar-unavailable',
  imports: [ZCalendar],
  template: `
    <z-calendar class="demo-narrow" label="Working day" today="2026-10-02" [isDateUnavailable]="isClosed">
      <span slot="footer">Closed on Saturdays, Sundays and Oct 20</span>
    </z-calendar>
  `,
})
export class CalendarUnavailable {
  readonly isClosed = isClosed;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCalendar, ZGrid } from '@zelviora/angular';

/** Selection modes: one day, several days, a range of days, and display only (no selection). */
@Component({
  selector: 'demo-calendar-variants',
  imports: [ZCalendar, ZGrid],
  template: `
    <z-grid columns="1 sm:2" gap="lg">
      <z-calendar label="single" today="2026-10-02" value="2026-10-15"></z-calendar>
      <z-calendar label="multiple" today="2026-10-02" selectionMode="multiple" [value]="multiple"></z-calendar>
      <z-calendar label="range" today="2026-10-02" selectionMode="range" [value]="range"></z-calendar>
      <z-calendar label="none" today="2026-10-02" selectionMode="none"></z-calendar>
    </z-grid>
  `,
})
export class CalendarVariants {
  readonly multiple = ['2026-10-06', '2026-10-08', '2026-10-20'];
  readonly range = ['2026-10-12', '2026-10-16'];
}

```


================================================================================
# COMPONENT: CANDLESTICK-CHART
================================================================================

## Documentation

# Candlestick chart (`<z-candlestick-chart>`)

Financial OHLC (Open-High-Low-Close) candlestick chart with zoom and custom field mapping.

## Installation & Import

```tsx
// React (@zelviora/react-chart)
import { ZCandlestickChart } from '@zelviora/react-chart';

// Vue 3 (@zelviora/vue-chart)
import { ZCandlestickChart } from '@zelviora/vue-chart';

// Angular (@zelviora/angular-chart)
import { ZCandlestickChart } from '@zelviora/angular-chart';

// Web Components (@zelviora/chart)
import '@zelviora/chart';
```

## Key Features

- **Tree-shaken ECharts 6 Core**: Automatically registers only the required ECharts chart module and components.
- **Design System Token Synchronization**: Reads `--z-chart-series-1..8`, `--z-chart-grid-color`, and `--z-chart-axis-color`, reacting automatically to Light/Dark mode and theme preset changes.
- **Built-in Accessibility (WCAG AAA)**: Renders a semantic `<figure>` with `<figcaption>`, interactive `aria-pressed` legend toggles, and a synchronized `<table>` for screen readers.
- **Escape Hatch (`option`)**: Deep-merges any raw ECharts `option` object on top of the declarative props.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCandlestickChart } from '@zelviora/angular-chart';
import { ohlcData, ohlcSeries } from '../data';

@Component({
  selector: 'demo-candlestick-chart-basic',
  imports: [ZCandlestickChart],
  template: `
    <z-candlestick-chart
      heading="Daily OHLC Price Action (USD)"
      description="Five-day trading sessions showing open, close, intraday low, and intraday high prices."
      xKey="date" openKey="open" closeKey="close" lowKey="low" highKey="high" [data]="data" [series]="series"
    ></z-candlestick-chart>
  `,
})
export class CandlestickChartBasic {
  readonly data = ohlcData;
  readonly series = ohlcSeries;
}

```

### Case: controlled

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/angular';
import { ZCandlestickChart, type ChartPointSelectDetail, type ChartSeriesToggleDetail } from '@zelviora/angular-chart';
import { ohlcData, ohlcSeries } from '../data';

@Component({
  selector: 'demo-candlestick-chart-controlled',
  imports: [ZStack, ZButton, ZBadge, ZText, ZCandlestickChart],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <z-button size="sm" variant="outline" (click)="hidden = []">
          Show All Series
        </z-button>
        <z-badge tone="primary" variant="soft">{{ selected }}</z-badge>
        <z-text variant="muted" size="sm">
          Hidden: {{ hidden.length ? hidden.join(', ') : 'none' }}
        </z-text>
      </z-stack>
      <z-candlestick-chart
        heading="Daily OHLC Price Action (USD) (Interactive)"
        description="Five-day trading sessions showing open, close, intraday low, and intraday high prices."
        xKey="date" openKey="open" closeKey="close" lowKey="low" highKey="high" [data]="data" [series]="series"
        [selectable]="true"
        [hiddenSeries]="hidden"
        (zSeriesToggle)="onToggle($event)"
        (zPointSelect)="onSelect($event)"
      ></z-candlestick-chart>
    </z-stack>
  `,
})
export class CandlestickChartControlled {
  readonly data = ohlcData;
  readonly series = ohlcSeries;
  hidden: string[] = [];
  selected = 'Click any chart element to inspect';

  onToggle(e: CustomEvent<ChartSeriesToggleDetail>) {
    this.hidden = e.detail.hiddenSeries;
  }

  onSelect(e: CustomEvent<ChartPointSelectDetail>) {
    this.selected = `Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`;
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCandlestickChart } from '@zelviora/angular-chart';
import { ohlcData, ohlcSeries } from '../data';

@Component({
  selector: 'demo-candlestick-chart-customization',
  imports: [ZCandlestickChart],
  template: `
    <z-candlestick-chart
      class="demo-chart-brand"
      description="Five-day trading sessions showing open, close, intraday low, and intraday high prices."
      [valueFormat]="{ maximumFractionDigits: 1 }"
      xKey="date" openKey="open" closeKey="close" lowKey="low" highKey="high" [dataZoom]="true" renderer="canvas" [data]="data" [series]="series"
    >
      <span slot="heading">Daily OHLC Price Action (USD) — Custom Theme Tokens &amp; Canvas</span>
    </z-candlestick-chart>
  `,
})
export class CandlestickChartCustomization {
  readonly data = ohlcData;
  readonly series = ohlcSeries;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZCandlestickChart } from '@zelviora/angular-chart';
import { ohlcData, ohlcSeries } from '../data';

@Component({
  selector: 'demo-candlestick-chart-states',
  imports: [ZStack, ZCandlestickChart],
  template: `
    <z-stack gap="lg">
      <z-candlestick-chart
        heading="Loading State (aria-busy)"
        [loading]="true"
        xKey="date" openKey="open" closeKey="close" lowKey="low" highKey="high" [data]="data" [series]="series"
      ></z-candlestick-chart>
      <z-candlestick-chart
        heading="Empty State"
        [data]="[]"
        [series]="series"
      ></z-candlestick-chart>
      <z-candlestick-chart
        heading="Expanded Accessible Data Table"
        description="Five-day trading sessions showing open, close, intraday low, and intraday high prices."
        [showDataTable]="true"
        xKey="date" openKey="open" closeKey="close" lowKey="low" highKey="high" [data]="data" [series]="series"
      ></z-candlestick-chart>
    </z-stack>
  `,
})
export class CandlestickChartStates {
  readonly data = ohlcData;
  readonly series = ohlcSeries;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZCandlestickChart } from '@zelviora/angular-chart';
import { ohlcData, ohlcSeries } from '../data';

@Component({
  selector: 'demo-candlestick-chart-variants',
  imports: [ZStack, ZCandlestickChart],
  template: `
    <z-stack gap="lg">
      <z-candlestick-chart
        heading="Interactive DataZoom Candlesticks"
        description="Interactive dataZoom trading view vs compact session view."
        xKey="date" openKey="open" closeKey="close" lowKey="low" highKey="high" [dataZoom]="true" [data]="data" [series]="series"
      ></z-candlestick-chart>
      <z-candlestick-chart
        heading="Standard Session View"
        description="Interactive dataZoom trading view vs compact session view."
        xKey="date" openKey="open" closeKey="close" lowKey="low" highKey="high" [hideLegend]="true" [data]="data" [series]="series"
      ></z-candlestick-chart>
    </z-stack>
  `,
})
export class CandlestickChartVariants {
  readonly data = ohlcData;
  readonly series = ohlcSeries;
}

```


================================================================================
# COMPONENT: CARD
================================================================================

## Documentation

# card — Angular

Processed requirements of [`<z-card>`](../../../../../requirements/04-components/data-display/card.md) for Angular (`@zelviora/angular`).

## Usage

```ts
import { Component } from '@angular/core';
import { ZButton, ZCard } from '@zelviora/angular';

@Component({
  selector: 'app-revenue',
  imports: [ZButton, ZCard],
  template: `
    <z-card heading="Revenue" description="Updated 2 hours ago" [headingLevel]="2">
      <p>1.2 billion VND</p>
      <z-button slot="footer">View details</z-button>
    </z-card>
  `,
})
export class Revenue {}
```

Slots are plain `slot="…"` attributes on projected children: `heading`, `description`, `header-actions`, `media`,
`footer`.

## Binding

No model event.

## Events

None; with `href` the native `click` of the heading link navigates.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `card-basic.ts` | D-1 Default |
| `variants` | `card-variants.ts` | D-3 Variants, D-6 elevated |
| `link` | `card-link.ts` | D-22 Card link |
| `loading` | `card-loading.ts` | D-20 Loading |

## Differences

- Boolean and number props are bound with `[prop]="…"` (`[required]="true"`, `[maxLength]="20"`), so the value reaches the element with its type.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZCard } from '@zelviora/angular';

@Component({
  selector: 'demo-card-basic',
  imports: [ZButton, ZCard],
  template: `
    <z-card heading="Revenue, September" description="Updated 2 hours ago" as="section" class="demo-narrow">
      <p>1.2 billion VND, up 12% from August.</p>
      <z-button slot="footer" variant="outline" tone="neutral">View details</z-button>
    </z-card>
  `,
})
export class CardBasic {}

```

### Case: link

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZCard } from '@zelviora/angular';

@Component({
  selector: 'demo-card-link',
  imports: [ZButton, ZCard],
  template: `
    <z-card heading="Quarterly report" description="Q3 2026" href="#report-q3" as="article" class="demo-narrow">
      <p>Click anywhere on the card to open the report.</p>
      <z-button slot="footer" variant="ghost" tone="neutral" (click)="share()">Share</z-button>
    </z-card>
  `,
})
export class CardLink {
  share() {
    console.log('shared');
  }
}

```

### Case: loading

#### Angular
```typescript
import { Component, DestroyRef, inject, signal } from '@angular/core';
import { ZCard } from '@zelviora/angular';

@Component({
  selector: 'demo-card-loading',
  imports: [ZCard],
  template: `
    <z-card heading="Active users" [loading]="loading()" class="demo-narrow">
      <p>4,210 users in the last 30 days.</p>
    </z-card>
  `,
})
export class CardLoading {
  readonly loading = signal(true);

  constructor() {
    const id = setTimeout(() => this.loading.set(false), 2000);
    inject(DestroyRef).onDestroy(() => clearTimeout(id));
  }
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCard, ZGrid } from '@zelviora/angular';

@Component({
  selector: 'demo-card-variants',
  imports: [ZCard, ZGrid],
  template: `
    <z-grid minColumnWidth="12rem">
      <z-card heading="Outline">Border and card background.</z-card>
      <z-card heading="Soft" variant="soft">Muted background, no border.</z-card>
      <z-card heading="Ghost" variant="ghost">No background or border.</z-card>
      <z-card heading="Elevated" [elevated]="true">Raised shadow.</z-card>
    </z-grid>
  `,
})
export class CardVariants {}

```


================================================================================
# COMPONENT: CAROUSEL
================================================================================

## Documentation

# carousel — Angular

Processed requirements of [`<z-carousel>`](../../../../../requirements/04-components/data-display/carousel.md) for Angular
(`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component, signal } from '@angular/core';
import { ZCarousel, ZCarouselItem } from '@zelviora/angular';

@Component({
  selector: 'app-offers',
  imports: [ZCarousel, ZCarouselItem],
  template: `
    <z-carousel label="Featured offers" [index]="index()" (zChange)="index.set($event.detail.index)">
      <z-carousel-item label="20% off"><img src="/a.jpg" alt="20% off in October" /></z-carousel-item>
    </z-carousel>
  `,
})
export class Offers { readonly index = signal(0); }
```

## Binding

Not a form control (spec §12): bind `[index]` + `(zChange)` (`{ index, reason }`); no value accessor.

Other events: `(zAutoplayChange)` (`{ playing }`). Methods on the element (`viewChild` + `ElementRef`): `next()`,
`previous()`, `goTo(index)`.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `carousel-default.ts` | D-1 Default (5 slides), D-15 Keyboard-only |
| `variants` | `carousel-variants.ts` | D-3 Variants (picker buttons / tabs / none) |
| `per-page` | `carousel-per-page.ts` | D-5 Sizes (2, 3 and `auto` per page), D-14 Long content (30 slides) |
| `states` | `carousel-states.ts` | D-6 States (first / last page, loop), D-20 Empty |
| `autoplay` | `carousel-autoplay.ts` | D-21 Autoplay |
| `controlled` | `carousel-controlled.ts` | D-9 Controlled (`index`, `goTo()`) |
| `composition` | `carousel-composition.ts` | D-17 Composition (card slides) |
| `vertical` | `carousel-vertical.ts` | D-22 Vertical |
| `i18n` | `carousel-i18n.ts` | D-19 i18n (vi), D-11 RTL |
| `customization` | `carousel-customization.ts` | D-18 Customization (tokens, `::part(picker-item-active)`) |

D-2 Playground, D-12 Dark, D-13 Brand showcase and D-16 Density come from the docs site (theme, brand and density
switchers); D-4 Tones, D-7 Disabled and D-10 In form do not apply. D-8 (broken image in a slide) is left to the image
component (ticket 89). The demos use tinted panels (`demo-carousel-slide`) instead of photos (no external image).

Rules used by the `per-page` and `customization` demos (`demo.css`):

```css
.demo-carousel-auto { --z-carousel-slides-per-page: 1; }
@container (min-width: 30rem) { .demo-carousel-auto { --z-carousel-slides-per-page: 2; } }
@container (min-width: 48rem) { .demo-carousel-auto { --z-carousel-slides-per-page: 3; } }

.demo-carousel-brand {
  --z-carousel-control-bg: var(--z-color-primary);
  --z-carousel-control-fg: var(--z-color-primary-foreground);
  --z-carousel-picker-active-color: var(--z-color-success);
  --z-carousel-radius: var(--z-radius-full);
}
.demo-carousel-brand::part(picker-item-active) {
  outline: var(--z-border-width-1) solid var(--z-color-success);
}
```

## Differences

- Slides outside the current page are `inert`: Tab never reaches them; swipe and scroll still preview them.
- A slide with only text has no focusable content: keyboard users move with the buttons and the picker (the track is
  not a Tab stop).
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: autoplay

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZCarousel, ZCarouselItem, ZStack } from '@zelviora/angular';

/**
 * Autoplay (off by default): the pause button comes first; hovering holds it, keyboard focus stops it for good, and it
 * only runs again from the play button. Autoplay moves are not announced.
 */
@Component({
  selector: 'demo-carousel-autoplay',
  imports: [ZCarousel, ZCarouselItem, ZStack],
  template: `
    <z-stack>
      <z-carousel label="Banner" [autoplay]="true" [autoplayInterval]="4000" (zAutoplayChange)="playing.set($event.detail.playing)">
        @for (s of slides; track s) {
          <z-carousel-item [label]="s"><div class="demo-carousel-slide">{{ s }}</div></z-carousel-item>
        }
      </z-carousel>
      <span>Autoplay: {{ playing() ? 'on' : 'stopped' }}</span>
    </z-stack>
  `,
})
export class CarouselAutoplay {
  readonly slides = ['20% off in October', 'Free shipping', 'Member gifts'];
  readonly playing = signal(true);
}

```

### Case: composition

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZCard, ZCarousel, ZCarouselItem } from '@zelviora/angular';

/** Slides are cards with actions, two per page; only the cards of the current page are reachable with Tab. */
@Component({
  selector: 'demo-carousel-composition',
  imports: [ZButton, ZCard, ZCarousel, ZCarouselItem],
  template: `
    <z-carousel label="Pricing" [slidesPerPage]="2">
      @for (p of plans; track p.name) {
        <z-carousel-item [label]="p.name">
          <z-card [heading]="p.name" [description]="p.price">
            <p>{{ p.text }}</p>
            <z-button size="sm">Choose plan</z-button>
          </z-card>
        </z-carousel-item>
      }
    </z-carousel>
  `,
})
export class CarouselComposition {
  readonly plans = [
    { name: 'Basic', price: '$9', text: '5 projects, 10 GB storage' },
    { name: 'Team', price: '2$9', text: '50 projects, 100 GB, team sharing' },
    { name: 'Business', price: 'Contact us', text: 'Unlimited, SSO, 24/7 support' },
    { name: 'Education', price: '$5', text: 'For schools and students' },
  ];
}

```

### Case: controlled

#### Angular
```typescript
import { Component, ElementRef, signal, viewChild } from '@angular/core';
import { ZButton, ZCarousel, ZCarouselItem, ZStack } from '@zelviora/angular';

/** The app owns `index`: setting it emits nothing; `goTo()` emits `reason: programmatic`; the log lists every change. */
@Component({
  selector: 'demo-carousel-controlled',
  imports: [ZButton, ZCarousel, ZCarouselItem, ZStack],
  template: `
    <z-stack>
      <z-carousel #carousel label="Controlled" [index]="index()" (zChange)="index.set($event.detail.index); add($event.detail.index + ' (' + $event.detail.reason + ')')">
        @for (s of slides; track s) {
          <z-carousel-item><div class="demo-carousel-slide">{{ s }}</div></z-carousel-item>
        }
      </z-carousel>
      <z-stack orientation="horizontal" gap="sm" [wrap]="true">
        <z-button variant="outline" tone="neutral" (click)="index.set(0)">index = 0</z-button>
        <z-button variant="outline" tone="neutral" (click)="index.set(4)">index = 4</z-button>
        <z-button variant="outline" tone="neutral" (click)="goTo(2)">goTo(2)</z-button>
      </z-stack>
      <span>Index: {{ index() }}</span>
      <output>{{ log().join(' · ') }}</output>
    </z-stack>
  `,
})
export class CarouselControlled {
  readonly slides = ['One', 'Two', 'Three', 'Four', 'Five'];
  readonly index = signal(1);
  readonly log = signal<string[]>([]);
  private readonly carousel = viewChild.required('carousel', { read: ElementRef });

  add(line: string) {
    this.log.update((l) => [line, ...l].slice(0, 5));
  }

  goTo(i: number) {
    void (this.carousel().nativeElement as HTMLElement & { goTo(i: number): Promise<void> }).goTo(i);
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCarousel, ZCarouselItem } from '@zelviora/angular';

/** Component tokens and parts (`::part(picker-item-active)`): see the `demo-carousel-brand` rule in README. */
@Component({
  selector: 'demo-carousel-customization',
  imports: [ZCarousel, ZCarouselItem],
  template: `
    <z-carousel class="demo-carousel-brand" label="Customization" [loop]="true">
      @for (s of slides; track s) {
        <z-carousel-item><div class="demo-carousel-slide">{{ s }}</div></z-carousel-item>
      }
    </z-carousel>
  `,
})
export class CarouselCustomization {
  readonly slides = ['One', 'Two', 'Three'];
}

```

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCarousel, ZCarouselItem } from '@zelviora/angular';

/** Five slides with previous / next buttons and a picker; swipe, scroll or drag the track; Tab reaches the buttons. */
@Component({
  selector: 'demo-carousel-default',
  imports: [ZCarousel, ZCarouselItem],
  template: `
    <z-carousel label="Featured offers">
      @for (s of slides; track s) {
        <z-carousel-item [label]="s"><div class="demo-carousel-slide">{{ s }}</div></z-carousel-item>
      }
    </z-carousel>
  `,
})
export class CarouselDefault {
  readonly slides = ['20% off in October', 'Free shipping', 'Member gifts', '0% installments', '30-day returns'];
}

```

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCarousel, ZCarouselItem, ZStack } from '@zelviora/angular';

/** Button and slide names follow the locale (vi); in RTL the next button scrolls toward the left. */
@Component({
  selector: 'demo-carousel-i18n',
  imports: [ZCarousel, ZCarouselItem, ZStack],
  template: `
    <z-stack gap="lg">
      <div lang="vi">
        <z-carousel label="Tiếng Việt">
          @for (s of slides; track s) {
            <z-carousel-item><div class="demo-carousel-slide">Slide {{ s }}</div></z-carousel-item>
          }
        </z-carousel>
      </div>
      <div dir="rtl" lang="ar">
        <z-carousel label="RTL" picker="tabs">
          @for (s of slides; track s) {
            <z-carousel-item><div class="demo-carousel-slide">RTL {{ s }}</div></z-carousel-item>
          }
        </z-carousel>
      </div>
    </z-stack>
  `,
})
export class CarouselI18n {
  readonly slides = ['1', '2', '3'];
}

```

### Case: per-page

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCarousel, ZCarouselItem, ZContainer, ZStack } from '@zelviora/angular';

/**
 * Two and three slides per page (30 slides), and `slidesPerPage="auto"` read from a container query
 * (`demo-carousel-auto` rule in README).
 */
@Component({
  selector: 'demo-carousel-per-page',
  imports: [ZCarousel, ZCarouselItem, ZContainer, ZStack],
  template: `
    <z-stack gap="lg">
      <z-carousel label="2 per page" [slidesPerPage]="2">
        @for (s of many.slice(0, 6); track s) {
          <z-carousel-item><div class="demo-carousel-slide">{{ s }}</div></z-carousel-item>
        }
      </z-carousel>
      <z-carousel label="3 per page, 30 slides" [slidesPerPage]="3" gap="sm">
        @for (s of many; track s) {
          <z-carousel-item><div class="demo-carousel-slide">{{ s }}</div></z-carousel-item>
        }
      </z-carousel>
      <z-container padding="none">
        <z-carousel class="demo-carousel-auto" label="auto" slidesPerPage="auto">
          @for (s of many.slice(0, 8); track s) {
            <z-carousel-item><div class="demo-carousel-slide">{{ s }}</div></z-carousel-item>
          }
        </z-carousel>
      </z-container>
    </z-stack>
  `,
})
export class CarouselPerPage {
  readonly many = Array.from({ length: 30 }, (_, i) => `Product ${i + 1}`);
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCarousel, ZCarouselItem, ZStack } from '@zelviora/angular';

/** First page (previous is aria-disabled, still focusable), last page, loop (no edge), and no slide (nothing shown). */
@Component({
  selector: 'demo-carousel-states',
  imports: [ZCarousel, ZCarouselItem, ZStack],
  template: `
    <z-stack gap="lg">
      <z-carousel label="First page">
        @for (s of slides; track s) {
          <z-carousel-item><div class="demo-carousel-slide">{{ s }}</div></z-carousel-item>
        }
      </z-carousel>
      <z-carousel label="Last page" [index]="2">
        @for (s of slides; track s) {
          <z-carousel-item><div class="demo-carousel-slide">{{ s }}</div></z-carousel-item>
        }
      </z-carousel>
      <z-carousel label="Loop" [loop]="true">
        @for (s of slides; track s) {
          <z-carousel-item><div class="demo-carousel-slide">loop: {{ s }}</div></z-carousel-item>
        }
      </z-carousel>
      <z-carousel label="Empty"></z-carousel>
    </z-stack>
  `,
})
export class CarouselStates {
  readonly slides = ['One', 'Two', 'Three'];
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCarousel, ZCarouselItem, ZStack } from '@zelviora/angular';

/** Picker as buttons with aria-current (default), as an APG tab list (arrow keys), or none. */
@Component({
  selector: 'demo-carousel-variants',
  imports: [ZCarousel, ZCarouselItem, ZStack],
  template: `
    <z-stack gap="lg">
      @for (picker of pickers; track picker) {
        <z-carousel [label]="'picker ' + picker" [picker]="picker">
          @for (s of slides; track s) {
            <z-carousel-item><div class="demo-carousel-slide">{{ picker }}: {{ s }}</div></z-carousel-item>
          }
        </z-carousel>
      }
    </z-stack>
  `,
})
export class CarouselVariants {
  readonly slides = ['One', 'Two', 'Three', 'Four'];
  readonly pickers = ['buttons', 'tabs', 'none'] as const;
}

```

### Case: vertical

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCarousel, ZCarouselItem } from '@zelviora/angular';

/** Vertical track (orientation vertical): buttons and picker move up and down. */
@Component({
  selector: 'demo-carousel-vertical',
  imports: [ZCarousel, ZCarouselItem],
  template: `
    <z-carousel label="News" orientation="vertical">
      @for (s of news; track s) {
        <z-carousel-item [label]="s"><div class="demo-carousel-slide">{{ s }}</div></z-carousel-item>
      }
    </z-carousel>
  `,
})
export class CarouselVertical {
  readonly news = ['Version 2.0 released', 'System maintenance on Oct 20', 'We are hiring engineers', 'User conference'];
}

```


================================================================================
# COMPONENT: CASCADER
================================================================================

## Documentation

# cascader — Angular

Processed requirements of [`<z-cascader>`](../../../../../requirements/04-components/form/cascader.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-cascader name="ward" label="Address" [options]="places" [(ngModel)]="path"></z-cascader>
```

## Binding

| Value accessor | Model | Event | Detail |
|---|---|---|---|
| `SelectValueAccessor` | `[(ngModel)]` / `formControl` (`string[] \| null`, path from the root) | `(zChange)` | `{ value, options }` |
| — | `[open]` (no two-way binding, D-031) | `(zOpenChange)` | `{ open, reason }` |

## Events

`(zChange)`, `(zExpandedChange)`, `(zSearch)`, `(zLoadMore)`, `(zOpenChange)`, `(zBeforeOpen)`, `(zBeforeClose)`, `(zAfterOpen)`, `(zAfterClose)`, `(zClear)`, `(zError)`.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `cascader-default.ts` | D-1 Default, D-3 `outline` / `filled`, D-6 States, D-7 Disabled (cascader, option) |
| `change-on-select` | `cascader-change-on-select.ts` | D-21 `changeOnSelect`, D-24 `expandTrigger="hover"` |
| `lazy` | `cascader-lazy.ts` | D-22 `loadChildren` (fixed delay) |
| `search` | `cascader-search.ts` | D-23 `searchable`, D-26 1,000 option column (virtual), search and load-more events |
| `form` | `cascader-form.ts` | D-10 In form, D-8 Error (required), D-25 `formValue="path"` |
| `i18n` | `cascader-i18n.ts` | D-19 i18n |

Not applicable: D-4 tones. Not yet covered: D-2 playground, D-9 controlled from buttons, D-11 RTL, D-12 dark,
D-13 brand showcase, D-14 long names (63 provinces), D-17 composition, D-18 customization, D-19 i18n.

## Differences

- A long path in the trigger is cut at the end with an ellipsis (the spec asks to keep the end visible ⚠️).
- Column names (read by screen readers) come from the `levelLabels` property, one entry per level (`['Province', 'District', 'Ward']`);
  a missing entry falls back to the i18n "Level {n}" label.
- A failed `loadChildren` is retried with Enter, → or a click on the option.
- Form reset does not emit events: reset the bound value yourself.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: change-on-select

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZCascader, ZStack } from '@zelviora/angular';
import { places } from '../data';

/** changeOnSelect: any level can be chosen; expandTrigger="hover" opens columns on mouse hover. */
@Component({
  selector: 'demo-cascader-change-on-select',
  imports: [ZCascader, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-cascader label="Region (any level)" [changeOnSelect]="true" [options]="places" (zChange)="value.set($event.detail.value)"></z-cascader>
      <span>Value: {{ value() ? value()!.join(' → ') : 'null' }}</span>
      <z-cascader label="Open on hover" expandTrigger="hover" [options]="places"></z-cascader>
    </z-stack>
  `,
})
export class CascaderChangeOnSelect {
  readonly places = places;
  readonly value = signal<string[] | null>(null);
}

```

### Case: default

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZCascader, ZStack } from '@zelviora/angular';
import { places } from '../data';

/** Province → district → ward; a disabled province, clear button; filled variant, disabled and readonly. */
@Component({
  selector: 'demo-cascader-default',
  imports: [ZCascader, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-cascader label="Address" [options]="places" [value]="value()" [clearable]="true" (zChange)="value.set($event.detail.value)"></z-cascader>
      <span>Value: {{ value() ? value()!.join(' → ') : 'null' }}</span>
      <z-cascader label="Filled" variant="filled" [options]="places" displaySeparator=" › "></z-cascader>
      <z-cascader label="Disabled" [options]="places" [value]="fixed" [disabled]="true"></z-cascader>
      <z-cascader label="Readonly" [options]="places" [value]="fixed" [readonly]="true"></z-cascader>
    </z-stack>
  `,
})
export class CascaderDefault {
  readonly places = places;
  readonly fixed = ['dn', 'hai-chau', 'thach-thang'];
  readonly value = signal<string[] | null>(['hn', 'ba-dinh', 'phuc-xa']);
}

```

### Case: form

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZCascader, ZStack } from '@zelviora/angular';
import { places } from '../data';

/**
 * Required in a native form: the leaf value (default) or every level (formValue="path").
 * FormsModule is not imported, so the form stays native and the element submits its own FormData entries.
 */
@Component({
  selector: 'demo-cascader-form',
  imports: [ZButton, ZCascader, ZStack],
  template: `
    <form class="demo-narrow" (submit)="submit($event)">
      <z-stack>
        <z-cascader name="ward" label="Ward / commune" hint="Required; submits the ward" [required]="true" [options]="places"></z-cascader>
        <z-cascader name="path" label="Path" hint='formValue="path": one entry per level' formValue="path" [options]="places"></z-cascader>
        <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
          <z-button type="submit">Submit</z-button>
          <z-button type="reset" variant="outline" tone="neutral">Reset</z-button>
        </z-stack>
        @if (sent()) {
          <output>{{ sent() }}</output>
        }
      </z-stack>
    </form>
  `,
})
export class CascaderForm {
  readonly places = places;
  readonly sent = signal('');

  submit(e: Event) {
    e.preventDefault();
    const data = new FormData(e.currentTarget as HTMLFormElement);
    this.sent.set(JSON.stringify({ ward: data.get('ward'), path: data.getAll('path') }));
  }
}

```

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCascader, ZConfigProvider } from '@zelviora/angular';
import { places } from '../data-i18n';

/** With locale `vi` the search ignores accents ("phuc xa" finds "Phúc Xá") and the built-in texts are Vietnamese. */
@Component({
  selector: 'demo-cascader-i18n',
  imports: [ZConfigProvider, ZCascader],
  template: `
    <z-config-provider locale="vi">
      <div class="demo-narrow">
        <z-cascader label="Tìm địa chỉ" [searchable]="true" [options]="places"></z-cascader>
      </div>
    </z-config-provider>
  `,
})
export class CascaderI18n {
  readonly places = places;
}

```

### Case: lazy

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCascader, ZStack } from '@zelviora/angular';
import { loadRegion, regions } from '../data';

/** loadChildren: columns load on demand (fixed delay); the option shows a busy indicator meanwhile. */
@Component({
  selector: 'demo-cascader-lazy',
  imports: [ZCascader, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-cascader label="Branch" [options]="regions" [loadChildren]="loadRegion"></z-cascader>
    </z-stack>
  `,
})
export class CascaderLazy {
  readonly regions = regions;
  readonly loadRegion = loadRegion;
}

```

### Case: search

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZCascader, ZStack } from '@zelviora/angular';
import { manyOptions, places } from '../data';

/** Search on any level (e.g. "phuc"); 1,000 options in a column scroll virtually, zLoadMore at the end. */
@Component({
  selector: 'demo-cascader-search',
  imports: [ZCascader, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-cascader label="Find address" [searchable]="true" [options]="places" (zSearch)="log.set('zSearch &quot;' + $event.detail.query + '&quot;')"></z-cascader>
      <z-cascader label="Units (1,000 items)" [searchable]="true" [options]="manyOptions" (zLoadMore)="log.set('zLoadMore')"></z-cascader>
      <output>{{ log() }}</output>
    </z-stack>
  `,
})
export class CascaderSearch {
  readonly places = places;
  readonly manyOptions = manyOptions;
  readonly log = signal('');
}

```


================================================================================
# COMPONENT: CHART
================================================================================

## Documentation

# chart — Angular

Processed requirements of [`<z-chart>`](../../../../../requirements/04-components/data-display/chart.md) for Angular (`@zelviora/angular/third-party`, optional package `@zelviora/third-party`).

## Usage

```ts
import { Component } from '@angular/core';
import '@zelviora/third-party/chart'; // once: registers the drawing library (optional peer d3-shape)
import { ZChart } from '@zelviora/angular/third-party';

@Component({
  selector: 'app-revenue',
  imports: [ZChart],
  template: `<z-chart type="bar" heading="Revenue per quarter" xKey="quarter" [data]="rows" [series]="series"></z-chart>`,
})
export class Revenue { rows = [{ quarter: 'Q1', y2025: 9.1 }]; series = [{ key: 'y2025', label: '2025' }]; }
```

Install `@zelviora/third-party` and its optional peer `d3-shape@3.2.0`. `data`, `series`, `valueFormat`, `xFormat` and
`hiddenSeries` are properties (objects and arrays). Set `heading` (caption and accessible name); `description` is read
as the summary of the trend. The data table is always available to screen readers (`showDataTable` shows it).

## Binding

| Input | Output |
|---|---|
| `[hiddenSeries]` | `(zSeriesToggle)` (`$event.detail.hiddenSeries`); no ngModel (not a form control) |

## Events

`(zSeriesToggle)`, `(zPointSelect)` (only with `selectable`). Setting `hiddenSeries` from the app emits nothing.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `chart-basic.ts` | D-1 Default |
| `types` | `chart-types.ts` | D-3 Variants (6 types, stacked, horizontal) |
| `states` | `chart-states.ts` | D-6 States, D-20 Empty / loading |
| `controlled` | `chart-controlled.ts` | D-9 Controlled (`hiddenSeries`) |
| `keyboard` | `chart-keyboard.ts` | D-15 Keyboard-only |
| `i18n` | `chart-i18n.ts` | D-19 i18n (`vi` / `en-US`) |
| `rtl` | `chart-rtl.ts` | D-11 RTL (Arabic labels, mirrored axis and arrow keys) |
| `theme` | `chart-theme.ts` | D-12 Dark (light and dark providers side by side) |
| `long` | `chart-long.ts` | D-14 Long content (200 points, long labels, large numbers) |
| `dashboard` | `chart-dashboard.ts` | D-17 Composition (charts in dashboard cards) |
| `customization` | `chart-customization.ts` | D-18 Customization (`--z-chart-series-1`, `heading` slot, parts) |

D-13 Brand showcase (accepted for v1, 2026-10-06): the docs site has no brand switcher; brands get `<prefix>-chart` from the brand build of the
third-party package (`packages.thirdParty: true` in the brand config). D-2 Playground comes from the docs site.
D-5, D-7, D-10, D-16: not applicable.

Customization class (copy into the app stylesheet):

```css
.demo-chart-brand {
  --z-chart-height: calc(var(--z-space-24) * 2.5);
  --z-chart-series-1: var(--z-color-success);
  --z-chart-series-2: var(--z-color-warning);
}
.demo-chart-brand::part(heading) { color: var(--z-color-primary-text); }
.demo-chart-brand::part(legend-item) { border-radius: var(--z-radius-full); }
```

## Differences

- Next.js: client components only (ADR-020).
- Without the `@zelviora/third-party/chart` import the element shows a short message and logs an `ZPeerDependencyError`.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
// Importing `@zelviora/third-party/chart` once registers the drawing library (optional peer `d3-shape`).
import '@zelviora/third-party/chart';
import { ZChart } from '@zelviora/angular/third-party';
import { revenue, revenueSeries } from '../data';

@Component({
  selector: 'demo-chart-basic',
  imports: [ZChart],
  template: `
    <z-chart
      type="bar"
      heading="Revenue per quarter (billion VND)"
      description="Revenue grows every quarter in both years; 2025 is ahead in each quarter and peaks at 12.5 in Q4."
      xKey="quarter"
      [data]="data"
      [series]="series"
    ></z-chart>
  `,
})
export class ChartBasic {
  readonly data = revenue;
  readonly series = revenueSeries;
}

```

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import '@zelviora/third-party/chart';
import { ZButton, ZStack } from '@zelviora/angular';
import { ZChart } from '@zelviora/angular/third-party';
import { revenue, revenueSeries } from '../data';

/** The app owns `hiddenSeries`: the buttons and the legend change the same state (zSeriesToggle). */
@Component({
  selector: 'demo-chart-controlled',
  imports: [ZButton, ZChart, ZStack],
  template: `
    <z-stack>
      <z-stack orientation="horizontal" gap="sm">
        @for (s of series; track s.key) {
          <z-button variant="outline" tone="neutral" (click)="toggle(s.key)">{{ hidden().includes(s.key) ? 'Show ' + s.label : 'Hide ' + s.label }}</z-button>
        }
      </z-stack>
      <z-chart
        type="line"
        heading="Revenue per quarter"
        xKey="quarter"
        [data]="data"
        [series]="series"
        [hiddenSeries]="hidden()"
        (zSeriesToggle)="hidden.set($event.detail.hiddenSeries)"
      ></z-chart>
    </z-stack>
  `,
})
export class ChartControlled {
  readonly data = revenue;
  readonly series = revenueSeries;
  readonly hidden = signal<string[]>(['y2024']);
  toggle(key: string) {
    this.hidden.update((h) => (h.includes(key) ? h.filter((k) => k !== key) : [...h, key]));
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import '@zelviora/third-party/chart';
import { ZChart } from '@zelviora/angular/third-party';
import { revenue, revenueSeries } from '../data';

/** Component tokens (series colors, height) and parts (heading, legend item) through the demo-chart-brand class. */
@Component({
  selector: 'demo-chart-customization',
  imports: [ZChart],
  template: `
    <z-chart class="demo-chart-brand" type="bar" xKey="quarter" [data]="data" [series]="series">
      <span slot="heading">Revenue per quarter, brand colors</span>
    </z-chart>
  `,
})
export class ChartCustomization {
  readonly data = revenue;
  readonly series = revenueSeries;
}

```

### Case: dashboard

#### Angular
```typescript
import { Component } from '@angular/core';
import '@zelviora/third-party/chart';
import { ZButton, ZCard, ZGrid, ZGridItem } from '@zelviora/angular';
import { ZChart } from '@zelviora/angular/third-party';
import { revenue, revenueSeries, traffic, visitsSeries } from '../data';

/** Charts in dashboard cards: the card gives the frame and actions, the chart keeps its own caption and data table. */
@Component({
  selector: 'demo-chart-dashboard',
  imports: [ZButton, ZCard, ZChart, ZGrid, ZGridItem],
  template: `
    <z-grid columns="1 md:2" gap="lg">
      <z-grid-item>
        <z-card heading="Revenue" description="Billion VND, 2024–2025" as="section">
          <z-chart type="bar" heading="Revenue per quarter" xKey="quarter" [data]="revenue" [series]="revenueSeries"></z-chart>
          <z-button slot="footer" variant="outline" tone="neutral">Open report</z-button>
        </z-card>
      </z-grid-item>
      <z-grid-item>
        <z-card heading="Traffic" description="Visits in September" as="section">
          <z-chart type="donut" heading="Visits by source" xKey="source" [data]="traffic" [series]="visitsSeries"></z-chart>
          <z-button slot="footer" variant="outline" tone="neutral">Open analytics</z-button>
        </z-card>
      </z-grid-item>
    </z-grid>
  `,
})
export class ChartDashboard {
  readonly revenue = revenue;
  readonly revenueSeries = revenueSeries;
  readonly traffic = traffic;
  readonly visitsSeries = visitsSeries;
}

```

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import '@zelviora/third-party/chart';
import { ZConfigProvider, ZGrid, ZGridItem } from '@zelviora/angular';
import { ZChart } from '@zelviora/angular/third-party';
import { revenueSeries, revenueVnd } from '../data';

/** Numbers and texts follow the locale of the nearest `lang` (config provider): `vi` and `en-US`. */
@Component({
  selector: 'demo-chart-i18n',
  imports: [ZChart, ZConfigProvider, ZGrid, ZGridItem],
  template: `
    <z-grid columns="1 md:2" gap="lg">
      <z-grid-item>
        <z-config-provider locale="vi">
          <z-chart heading="Doanh thu theo quý" [showDataTable]="true" [valueFormat]="money" xKey="quarter" [data]="data" [series]="series"></z-chart>
        </z-config-provider>
      </z-grid-item>
      <z-grid-item>
        <z-config-provider locale="en-US">
          <z-chart heading="Revenue per quarter" [showDataTable]="true" [valueFormat]="money" xKey="quarter" [data]="data" [series]="series"></z-chart>
        </z-config-provider>
      </z-grid-item>
    </z-grid>
  `,
})
export class ChartI18n {
  readonly data = revenueVnd;
  readonly series = revenueSeries;
  readonly money: Intl.NumberFormatOptions = { style: 'currency', currency: 'VND', notation: 'compact' };
}

```

### Case: keyboard

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import '@zelviora/third-party/chart';
import type { ZChartPointSelectDetail } from '@zelviora/third-party';
import { ZStack } from '@zelviora/angular';
import { ZChart } from '@zelviora/angular/third-party';
import { revenue, revenueSeries } from '../data';

/** Tab to the plot, move with the arrow keys (the value is announced), Enter selects, Escape hides the tooltip. */
@Component({
  selector: 'demo-chart-keyboard',
  imports: [ZChart, ZStack],
  template: `
    <z-stack>
      <z-chart type="bar" heading="Revenue per quarter" [selectable]="true" xKey="quarter" [data]="data" [series]="series" (zPointSelect)="onSelect($event.detail)"></z-chart>
      <output>{{ picked() }}</output>
    </z-stack>
  `,
})
export class ChartKeyboard {
  readonly data = revenue;
  readonly series = revenueSeries;
  readonly picked = signal('Nothing selected');
  onSelect(d: ZChartPointSelectDetail) {
    this.picked.set(`${d.seriesKey} · ${String(d.datum['quarter'])}`);
  }
}

```

### Case: long

#### Angular
```typescript
import { Component } from '@angular/core';
import '@zelviora/third-party/chart';
import { ZStack } from '@zelviora/angular';
import { ZChart } from '@zelviora/angular/third-party';
import { regions, salesSeries, signups, signupsSeries } from '../data';

/** 200 points with a long series label, then long category names with large numbers (compact currency). */
@Component({
  selector: 'demo-chart-long',
  imports: [ZChart, ZStack],
  template: `
    <z-stack gap="lg">
      <z-chart type="line" heading="Sign-ups over 200 days" xKey="day" [data]="signups" [series]="signupsSeries"></z-chart>
      <z-chart type="bar" orientation="horizontal" heading="Sales by region" [valueFormat]="vnd" xKey="region" [data]="regions" [series]="salesSeries" [showDataTable]="true"></z-chart>
    </z-stack>
  `,
})
export class ChartLong {
  readonly signups = signups;
  readonly signupsSeries = signupsSeries;
  readonly regions = regions;
  readonly salesSeries = salesSeries;
  readonly vnd: Intl.NumberFormatOptions = { style: 'currency', currency: 'VND', notation: 'compact' };
}

```

### Case: rtl

#### Angular
```typescript
import { Component } from '@angular/core';
import '@zelviora/third-party/chart';
import { ZGrid, ZGridItem } from '@zelviora/angular';
import { ZChart } from '@zelviora/angular/third-party';
import { revenueAr, revenueSeriesAr } from '../data';

/** RTL: the category axis runs from the right, value ticks sit on the right and the arrow keys follow the reading order. */
@Component({
  selector: 'demo-chart-rtl',
  imports: [ZChart, ZGrid, ZGridItem],
  template: `
    <div dir="rtl" lang="ar">
      <z-grid columns="1 md:2" gap="lg">
        <z-grid-item><z-chart type="bar" heading="الإيرادات حسب الربع" xKey="quarter" [data]="data" [series]="series" [keyboardNavigation]="true"></z-chart></z-grid-item>
        <z-grid-item><z-chart type="line" heading="الإيرادات حسب الربع (خط)" xKey="quarter" [data]="data" [series]="series"></z-chart></z-grid-item>
      </z-grid>
    </div>
  `,
})
export class ChartRtl {
  readonly data = revenueAr;
  readonly series = revenueSeriesAr;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import '@zelviora/third-party/chart';
import { ZGrid, ZGridItem } from '@zelviora/angular';
import { ZChart } from '@zelviora/angular/third-party';
import { revenue, revenueSeries } from '../data';

/** Loading (skeleton, aria-busy), empty data (default empty state) and the data table shown visually. */
@Component({
  selector: 'demo-chart-states',
  imports: [ZChart, ZGrid, ZGridItem],
  template: `
    <z-grid columns="1 md:2" gap="lg">
      <z-grid-item><z-chart heading="Loading" [loading]="true" xKey="quarter" [data]="revenue" [series]="series"></z-chart></z-grid-item>
      <z-grid-item><z-chart heading="No data yet" xKey="quarter" [data]="[]" [series]="series"></z-chart></z-grid-item>
      <z-grid-item><z-chart type="line" heading="With the data table" [showDataTable]="true" xKey="quarter" [data]="revenue" [series]="series"></z-chart></z-grid-item>
    </z-grid>
  `,
})
export class ChartStates {
  readonly revenue = revenue;
  readonly series = revenueSeries;
}

```

### Case: theme

#### Angular
```typescript
import { Component } from '@angular/core';
import '@zelviora/third-party/chart';
import { ZCard, ZConfigProvider, ZGrid, ZGridItem } from '@zelviora/angular';
import { ZChart } from '@zelviora/angular/third-party';
import { revenue, revenueSeries } from '../data';

/** Light and dark side by side: series, grid and axis colors come from tokens, so a theme change restyles the chart. */
@Component({
  selector: 'demo-chart-theme',
  imports: [ZCard, ZChart, ZConfigProvider, ZGrid, ZGridItem],
  template: `
    <z-grid columns="1 md:2" gap="lg">
      <z-grid-item>
        <z-config-provider theme="light">
          <z-card><z-chart type="area" heading="Revenue (light)" xKey="quarter" [data]="data" [series]="series"></z-chart></z-card>
        </z-config-provider>
      </z-grid-item>
      <z-grid-item>
        <z-config-provider theme="dark">
          <z-card><z-chart type="area" heading="Revenue (dark)" xKey="quarter" [data]="data" [series]="series"></z-chart></z-card>
        </z-config-provider>
      </z-grid-item>
    </z-grid>
  `,
})
export class ChartTheme {
  readonly data = revenue;
  readonly series = revenueSeries;
}

```

### Case: types

#### Angular
```typescript
import { Component } from '@angular/core';
import '@zelviora/third-party/chart';
import { ZGrid, ZGridItem } from '@zelviora/angular';
import { ZChart } from '@zelviora/angular/third-party';
import { latency, latencySeries, revenue, revenueSeries, traffic, visitsSeries } from '../data';

/** Six types; series also differ by marker shape and line dash, not only by color. */
@Component({
  selector: 'demo-chart-types',
  imports: [ZChart, ZGrid, ZGridItem],
  template: `
    <z-grid columns="1 md:2" gap="lg">
      <z-grid-item><z-chart type="bar" heading="Bar, stacked" [stacked]="true" xKey="quarter" [data]="revenue" [series]="revenueSeries"></z-chart></z-grid-item>
      <z-grid-item><z-chart type="bar" orientation="horizontal" heading="Bar, horizontal" xKey="quarter" [data]="revenue" [series]="revenueSeries"></z-chart></z-grid-item>
      <z-grid-item><z-chart type="line" heading="Line" xKey="quarter" [data]="revenue" [series]="revenueSeries"></z-chart></z-grid-item>
      <z-grid-item><z-chart type="area" heading="Area, stacked" [stacked]="true" xKey="quarter" [data]="revenue" [series]="revenueSeries"></z-chart></z-grid-item>
      <z-grid-item><z-chart type="pie" heading="Pie" xKey="source" [data]="traffic" [series]="visitsSeries"></z-chart></z-grid-item>
      <z-grid-item><z-chart type="donut" heading="Donut" xKey="source" [data]="traffic" [series]="visitsSeries"></z-chart></z-grid-item>
      <z-grid-item><z-chart type="scatter" heading="Scatter: latency (ms) by payload (kB)" xKey="size" [data]="latency" [series]="latencySeries"></z-chart></z-grid-item>
    </z-grid>
  `,
})
export class ChartTypes {
  readonly revenue = revenue;
  readonly revenueSeries = revenueSeries;
  readonly traffic = traffic;
  readonly visitsSeries = visitsSeries;
  readonly latency = latency;
  readonly latencySeries = latencySeries;
}

```


================================================================================
# COMPONENT: CHECKBOX
================================================================================

## Documentation

# checkbox — Angular

Processed requirements of [`<z-checkbox>` and `<z-checkbox-group>`](../../../../../requirements/04-components/form/checkbox.md)
for Angular (`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { BooleanValueAccessor, SelectValueAccessor, ZCheckbox, ZCheckboxGroup } from '@zelviora/angular';

@Component({
  selector: 'app-toppings',
  imports: [FormsModule, BooleanValueAccessor, SelectValueAccessor, ZCheckbox, ZCheckboxGroup],
  template: `
    <z-checkbox name="agree" [(ngModel)]="agree">I agree</z-checkbox>
    <z-checkbox-group name="toppings" label="Toppings" [(ngModel)]="toppings">
      <z-checkbox value="cheese">Cheese</z-checkbox>
    </z-checkbox-group>
  `,
})
export class Toppings { agree = false; toppings: string[] = []; }
```

## Binding

| Component | Value accessor | Model | Event | Detail |
|---|---|---|---|---|
| `ZCheckbox` | `BooleanValueAccessor` | `[(ngModel)]` / `formControl` (`boolean`) | `(zChange)` | `{ checked, value }` |
| `ZCheckboxGroup` | `SelectValueAccessor` | `[(ngModel)]` / `formControl` (`string[]`) | `(zChange)` | `{ value, changed, checked }` |

A checkbox inside a group does not emit its own `zChange`; the group does.

## Validation (F15)

`BooleanValueAccessor` applies `ValidityValidator`: the native validity of the element reaches Angular forms, so
`required` + `[(ngModel)]` makes the control invalid while unchecked (error `required`, plus `zValidity`). In Reactive
Forms declare `Validators.requiredTrue` (`Validators.required` counts `false` as a value).

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `checkbox-default.ts` | D-1 Default |
| `states` | `checkbox-states.ts` | D-6 States |
| `group` | `checkbox-group.ts` | D-17 Composition (group), D-9 Controlled (`ngModel`) |
| `select-all` | `checkbox-select-all.ts` | D-17 Composition (select all) |

## Differences

- Boolean and number props are bound with `[prop]="…"` (`[checked]="true"`), so the value reaches the element with its type.
- Form reset (`form.reset()`) does not emit events: reset the model yourself.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCheckbox } from '@zelviora/angular';

@Component({
  selector: 'demo-checkbox-default',
  imports: [ZCheckbox],
  template: `<z-checkbox name="remember">Remember me</z-checkbox>`,
})
export class CheckboxDefault {}

```

### Case: group

#### Angular
```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SelectValueAccessor, ZCheckbox, ZCheckboxGroup, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-checkbox-group',
  imports: [FormsModule, SelectValueAccessor, ZCheckbox, ZCheckboxGroup, ZStack],
  template: `
    <z-stack>
      <z-checkbox-group name="toppings" label="Toppings" hint="Pick at least one." [required]="true" [(ngModel)]="value">
        <z-checkbox value="cheese">Cheese</z-checkbox>
        <z-checkbox value="mushroom">Mushroom</z-checkbox>
        <z-checkbox value="olive">Olive</z-checkbox>
      </z-checkbox-group>
      <p>Selected: {{ value.join(', ') || 'none' }}</p>
    </z-stack>
  `,
})
export class CheckboxGroup {
  value: string[] = ['cheese'];
}

```

### Case: select-all

#### Angular
```typescript
import { Component, computed, signal } from '@angular/core';
import { ZCheckbox, ZStack } from '@zelviora/angular';

const FILES = ['report.pdf', 'budget.xlsx', 'notes.txt'];

@Component({
  selector: 'demo-checkbox-select-all',
  imports: [ZCheckbox, ZStack],
  template: `
    <z-stack gap="sm">
      <z-checkbox [checked]="all()" [indeterminate]="some()" (zChange)="selected.set($event.detail.checked ? files : [])">
        Select all files
      </z-checkbox>
      @for (f of files; track f) {
        <z-checkbox [checked]="selected().includes(f)" (zChange)="toggle(f, $event.detail.checked)">{{ f }}</z-checkbox>
      }
    </z-stack>
  `,
})
export class CheckboxSelectAll {
  readonly files = FILES;
  readonly selected = signal<string[]>(['report.pdf']);
  readonly all = computed(() => this.selected().length === FILES.length);
  readonly some = computed(() => this.selected().length > 0 && !this.all());

  toggle(file: string, checked: boolean) {
    this.selected.update((s) => (checked ? [...s, file] : s.filter((x) => x !== file)));
  }
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCheckbox, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-checkbox-states',
  imports: [ZCheckbox, ZStack],
  template: `
    <z-stack gap="sm">
      <z-checkbox>Unchecked</z-checkbox>
      <z-checkbox [checked]="true">Checked</z-checkbox>
      <z-checkbox [indeterminate]="true">Indeterminate</z-checkbox>
      <z-checkbox [disabled]="true" [checked]="true">Disabled</z-checkbox>
      <z-checkbox [readonly]="true" [checked]="true">Read-only</z-checkbox>
      <z-checkbox [invalid]="true" hint="You must accept the terms to continue.">I accept the terms</z-checkbox>
    </z-stack>
  `,
})
export class CheckboxStates {}

```


================================================================================
# COMPONENT: CODE-BLOCK
================================================================================

## Documentation

# code-block — Angular

Processed requirements of [`<z-code-block>`](../../../../../requirements/04-components/data-display/code-block.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-code-block language="bash" code="pnpm add @zelviora/core"></z-code-block>
```

## Binding

No model event. `highlight` is a function set as a property: `(code, language) => { text, role? }[][]` (one token array per line). Search keyword: "Code", "copy to clipboard", "syntax highlight".

## Events

| Output | Detail | Notes |
|---|---|---|
| `(zCopy)` | `{ text }` | Before writing the clipboard; cancelable: `e.preventDefault()` skips the copy |

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `code-block-basic.ts` | D-1 Default, D-6 States (copied) |
| `line-numbers` | `code-block-line-numbers.ts` | D-21 Line numbers + highlight |
| `long` | `code-block-long.ts` | D-14 Long content, D-15 Keyboard-only |
| `controlled` | `code-block-controlled.ts` | D-9 Controlled |
| `highlighter` | `code-block-highlighter.ts` | D-18 Customization |
| `tabs` | `code-block-tabs.ts` | D-17 Composition |


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCodeBlock } from '@zelviora/angular';

@Component({
  selector: 'demo-code-block-basic',
  imports: [ZCodeBlock],
  template: `
    <z-code-block language="ts" [code]="code"></z-code-block>
  `,
})
export class CodeBlockBasic {
  readonly code = `import { ZButton } from '@zelviora/angular';

// <z-button>Save</z-button>`;
}

```

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZCodeBlock, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-code-block-controlled',
  imports: [ZCodeBlock, ZStack],
  template: `
    <z-stack gap="sm">
      <z-code-block language="bash" code="export API_KEY=sk_live_1234" (zCopy)="onCopy($event)"></z-code-block>
      <span>{{ message() || 'Press the copy button.' }}</span>
    </z-stack>
  `,
})
export class CodeBlockControlled {
  readonly message = signal('');

  // Cancel the default copy and copy a masked value instead.
  onCopy(e: CustomEvent<{ text: string }>) {
    e.preventDefault();
    void navigator.clipboard?.writeText('export API_KEY=<your key>');
    this.message.set(`Copied a masked version of: ${e.detail.text.length} characters`);
  }
}

```

### Case: highlighter

#### Angular
```typescript
import { Component } from '@angular/core';
import type { ZCodeHighlighter } from '@zelviora/core';
import { ZCodeBlock } from '@zelviora/angular';

const KEYWORDS = /\b(const|let|function|return|if|else|import|from|export)\b/;

/** A tiny highlighter written in the app: keywords, strings, numbers and comments (data, never HTML). */
const highlight: ZCodeHighlighter = (code) =>
  code.split('\n').map((line) =>
    line.split(/(\/\/.*$|'[^']*'|\b\d+\b|\b\w+\b)/).filter(Boolean).map((text) => {
      if (text.startsWith('//')) return { text, role: 'comment' as const };
      if (text.startsWith("'")) return { text, role: 'string' as const };
      if (/^\d+$/.test(text)) return { text, role: 'number' as const };
      if (KEYWORDS.test(text)) return { text, role: 'keyword' as const };
      return { text };
    }),
  );

@Component({
  selector: 'demo-code-block-highlighter',
  imports: [ZCodeBlock],
  template: `
    <z-code-block filename="shipping.js" language="js" [highlight]="highlight" [code]="code"></z-code-block>
  `,
})
export class CodeBlockHighlighter {
  readonly highlight = highlight;
  readonly code = `import { total } from './cart';

// Free shipping above 500 000 ₫
export function shipping(amount) {
  if (amount >= 500000) return 0;
  return 30000;
}`;
}

```

### Case: line-numbers

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCodeBlock } from '@zelviora/angular';

@Component({
  selector: 'demo-code-block-line-numbers',
  imports: [ZCodeBlock],
  template: `
    <z-code-block filename="package.json" language="json" [lineNumbers]="true" highlightLines="4-6" [code]="code"></z-code-block>
  `,
})
export class CodeBlockLineNumbers {
  readonly code = `{
  "name": "shop",
  "private": true,
  "dependencies": {
    "@zelviora/core": "^1.0.0"
  }
}`;
}

```

### Case: long

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCodeBlock, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-code-block-long',
  imports: [ZCodeBlock, ZStack],
  template: `
    <z-stack gap="md">
      <z-code-block language="bash" [code]="longLine"></z-code-block>
      <z-code-block language="bash" [wrap]="true" [code]="longLine"></z-code-block>
      <z-code-block filename="worker.log" [lineNumbers]="true" [code]="log"></z-code-block>
    </z-stack>
  `,
})
export class CodeBlockLong {
  readonly longLine = `curl -X POST https://api.example.com/v1/orders -H "Authorization: Bearer ${'x'.repeat(120)}" -d '{"items":[{"sku":"A-1","qty":2}]}'`;
  readonly log = Array.from({ length: 120 }, (_, i) => `[2026-10-05 09:${String(i % 60).padStart(2, '0')}] worker-${i % 4} processed job #${1000 + i}`).join('\n');
}

```

### Case: tabs

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCodeBlock, ZTabs, ZTabsList, ZTabsPanel, ZTabsTrigger } from '@zelviora/angular';

@Component({
  selector: 'demo-code-block-tabs',
  imports: [ZCodeBlock, ZTabs, ZTabsList, ZTabsPanel, ZTabsTrigger],
  template: `
    <z-tabs defaultValue="angular">
      <z-tabs-list label="Framework">
        <z-tabs-trigger value="html">HTML</z-tabs-trigger>
        <z-tabs-trigger value="react">React</z-tabs-trigger>
        <z-tabs-trigger value="vue">Vue</z-tabs-trigger>
        <z-tabs-trigger value="angular">Angular</z-tabs-trigger>
      </z-tabs-list>
      <z-tabs-panel value="html"><z-code-block language="html" [code]="html"></z-code-block></z-tabs-panel>
      <z-tabs-panel value="react"><z-code-block language="tsx" [code]="jsx"></z-code-block></z-tabs-panel>
      <z-tabs-panel value="vue"><z-code-block language="vue" [code]="jsx"></z-code-block></z-tabs-panel>
      <z-tabs-panel value="angular"><z-code-block language="html" [code]="html"></z-code-block></z-tabs-panel>
    </z-tabs>
  `,
})
export class CodeBlockTabs {
  readonly html = '<z-button>Save</z-button>';
  readonly jsx = '<ZButton>Save</ZButton>';
}

```


================================================================================
# COMPONENT: CODE-EDITOR
================================================================================

## Documentation

# Code editor

Accessible, syntax-highlighted code editor supporting indentation, line numbers, and form association.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCodeEditor } from '@zelviora/angular';

@Component({
  selector: 'demo-code-editor-basic',
  imports: [ZCodeEditor],
  template: `
    <z-code-editor language="typescript" [value]="code"></z-code-editor>
  `,
})
export class CodeEditorBasic {
  readonly code = `function greet(name: string): string {
  return \`Hello, \${name}!\`;
}`;
}

```

### Case: form

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZCodeEditor, ZStack } from '@zelviora/angular';

@Component({
  selector: 'app-code-editor-form',
  standalone: true,
  imports: [ZButton, ZCodeEditor, ZStack],
  template: `
    <form class="demo-narrow" (submit)="onSubmit($event)">
      <z-stack gap="md">
        <z-code-editor
          name="snippet"
          label="Configuration script"
          hint="Enter JSON or JavaScript config snippet."
          language="javascript"
          required
          value='{\\n  "version": "1.0.0",\\n  "enabled": true\\n}'
        ></z-code-editor>
        <z-stack orientation="horizontal" wrap align-items="center" gap="sm">
          <z-button type="submit">Submit code</z-button>
          @if (submitted() !== null) {
            <output>Submitted: {{ submitted()?.length }} chars</output>
          }
        </z-stack>
      </z-stack>
    </form>
  `,
})
export class CodeEditorForm {
  readonly submitted = signal<string | null>(null);

  onSubmit(e: Event) {
    e.preventDefault();
    const form = e.currentTarget as HTMLFormElement;
    const data = new FormData(form);
    this.submitted.set(String(data.get('snippet') || ''));
  }
}

```


================================================================================
# COMPONENT: CODE-HIGHLIGHTER
================================================================================

## Documentation

# code-highlighter — Angular (`@deprecated`)

> **Deprecated:** `<z-code-highlighter>` (`ZCodeHighlighter`) is deprecated and retained only as a compatibility alias. Use [`<z-code-block>` (`ZCodeBlock`)](../code-block/README.md) instead.

Syntax-highlighted code block with line numbering, copy action, and theme support.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCodeHighlighter } from '@zelviora/angular';

@Component({
  selector: 'demo-code-highlighter-basic',
  imports: [ZCodeHighlighter],
  template: `
    <z-code-highlighter language="javascript" [value]="code"></z-code-highlighter>
  `,
})
export class CodeHighlighterBasic {
  readonly code = `function calculateTotal(items) {
  return items.reduce((sum, item) => sum + item.price, 0);
}`;
}

```

### Case: line-numbers

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCodeHighlighter } from '@zelviora/angular';

@Component({
  selector: 'demo-code-highlighter-line-numbers',
  imports: [ZCodeHighlighter],
  template: `
    <z-code-highlighter language="typescript" line-numbers [value]="code"></z-code-highlighter>
  `,
})
export class CodeHighlighterLineNumbers {
  readonly code = `import { useState } from 'react';

export function Counter() {
  const [count, setCount] = useState(0);
  return <button onClick={() => setCount(count + 1)}>{count}</button>;
}`;
}

```


================================================================================
# COMPONENT: COLLAPSIBLE
================================================================================

## Documentation

# collapsible — Angular

Processed requirements of `z-collapsible`, `z-collapsible-trigger` and `z-collapsible-content` ([spec](../../../../../requirements/04-components/navigation/collapsible.md)) for Angular
(`@zelviora/angular`).

## Binding and events

| Input | Output | Detail |
|---|---|---|
| `[open]` | `(zOpenChange)` | `{ open, reason }` |

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `collapsible-default.ts` | D-1 Default, D-15 Keyboard-only, D-14 Long content |
| `controlled` | `collapsible-controlled.ts` | D-9 Controlled, D-10 In form (advanced fields) |
| `custom-indicator` | `collapsible-custom-indicator.ts` | D-18 Customization, D-7 Disabled |

## Differences

- Bind booleans with `[prop]="true"`; plain attributes are strings.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZCollapsible, ZCollapsibleContent, ZCollapsibleTrigger, ZInput, ZStack } from '@zelviora/angular';
import type { ZCollapsibleOpenChangeDetail } from '@zelviora/core';

@Component({
  selector: 'demo-collapsible-controlled',
  imports: [ZButton, ZCollapsible, ZCollapsibleContent, ZCollapsibleTrigger, ZInput, ZStack],
  template: `
    <z-stack gap="sm">
      <z-stack orientation="horizontal" gap="sm" align-items="center">
        <z-button variant="outline" tone="neutral" (click)="open.set(!open())">Toggle from state</z-button>
        <span>open: {{ open() }}</span>
      </z-stack>
      <z-collapsible [open]="open()" (zOpenChange)="onOpenChange($event.detail)">
        <z-collapsible-trigger>Advanced options</z-collapsible-trigger>
        <z-collapsible-content>
          <z-stack gap="sm">
            <z-input label="Proxy server" name="proxy"></z-input>
            <z-input label="Timeout (seconds)" name="timeout"></z-input>
          </z-stack>
        </z-collapsible-content>
      </z-collapsible>
      <ul>
        @for (l of log(); track $index) {
          <li>{{ l }}</li>
        }
      </ul>
    </z-stack>
  `,
})
export class CollapsibleControlled {
  readonly open = signal(false);
  readonly log = signal<string[]>([]);

  onOpenChange(detail: ZCollapsibleOpenChangeDetail) {
    this.open.set(detail.open);
    this.log.update((l) => [...l, `${detail.open ? 'opened' : 'closed'} (${detail.reason})`]);
  }
}

```

### Case: custom-indicator

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCollapsible, ZCollapsibleContent, ZCollapsibleTrigger, ZIcon, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-collapsible-custom-indicator',
  imports: [ZCollapsible, ZCollapsibleContent, ZCollapsibleTrigger, ZIcon, ZStack],
  template: `
    <z-stack gap="md">
      <z-collapsible [defaultOpen]="true">
        <z-collapsible-trigger>
          Release notes
          <z-icon slot="indicator" name="add"></z-icon>
        </z-collapsible-trigger>
        <z-collapsible-content>Version 2.4 adds dark mode and faster search.</z-collapsible-content>
      </z-collapsible>
      <z-collapsible [disabled]="true">
        <z-collapsible-trigger>Archived notes (disabled)</z-collapsible-trigger>
        <z-collapsible-content>Not available.</z-collapsible-content>
      </z-collapsible>
    </z-stack>
  `,
})
export class CollapsibleCustomIndicator {}

```

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCollapsible, ZCollapsibleContent, ZCollapsibleTrigger } from '@zelviora/angular';

@Component({
  selector: 'demo-collapsible-default',
  imports: [ZCollapsible, ZCollapsibleContent, ZCollapsibleTrigger],
  template: `
    <z-collapsible>
      <z-collapsible-trigger>Show more</z-collapsible-trigger>
      <z-collapsible-content>
        <p>Orders ship from our Hanoi warehouse within two business days. Returns are accepted for 30 days.</p>
      </z-collapsible-content>
    </z-collapsible>
  `,
})
export class CollapsibleDefault {}

```


================================================================================
# COMPONENT: COLOR-PICKER
================================================================================

## Documentation

# color-picker — Angular

Processed requirements of [`<z-color-picker>`](../../../../../requirements/04-components/form/color-picker.md) for Angular
(`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { TextValueAccessor, ZColorPicker } from '@zelviora/angular';

@Component({
  selector: 'app-demo',
  imports: [FormsModule, TextValueAccessor, ZColorPicker],
  template: `<z-color-picker name="brand" label="Brand color" [(ngModel)]="color"></z-color-picker>`,
})
export class Demo {
  color = '#2563eb';
}
```

## Binding

| Component | Value accessor | Model | Event | Detail |
|---|---|---|---|---|
| `ZColorPicker` | `TextValueAccessor` (spec §12: `text`) | `[(ngModel)]` / `formControl` (`string`) | `(zInput)` | `{ value }` |
| `ZColorPicker` | — | `[open]` (no two-way binding, D-031) | `(zOpenChange)` | `{ open, reason }` |

Other events: `(zChange)` (committed: pointer released, key, Enter/blur of the hex field, swatch, clear), `(zBeforeClose)` (cancelable).
`swatches` is an array property; any CSS color in `value` is converted to lower-case hex (dev warning).

The accessor applies `ValidityValidator`: `required` (`valueMissing`) and a wrong hex code (`badInput`) reach the Angular control errors.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `color-picker-default.ts` | D-1 Default (`#2563eb`), D-15 Keyboard-only |
| `variants` | `color-picker-variants.ts` | D-3 Variants (trigger outline/filled, `inline`), D-5 Sizes |
| `states` | `color-picker-states.ts` | D-6 States, D-7 Disabled, D-20 Empty (`placeholder`) |
| `validation` | `color-picker-validation.ts` | D-8 Error (wrong hex, required) |
| `controlled` | `color-picker-controlled.ts` | D-9 Controlled (synced preview) |
| `form` | `color-picker-form.ts` | D-10 In form, D-17 Composition (field) |
| `i18n` | `color-picker-i18n.ts` | D-19 i18n (slider labels vi/en), D-11 RTL |
| `customization` | `color-picker-customization.ts` | D-18 Customization (component tokens) |
| `alpha` | `color-picker-alpha.ts` | D-21 Alpha |
| `swatches` | `color-picker-swatches.ts` | D-22 Swatches, D-14 Long content (40 swatches) |

D-2 Playground, D-12 Dark, D-13 Brand showcase and D-16 Density come from the docs site switchers; D-4 Tones does not apply.

The `customization` demo uses the `demo-color-picker-brand` rule of `demo.css` (same rule as the React README).

## Differences

- The model event is `zInput` (every drag step); `zChange` marks a committed color.
- The eyedropper button shows only where the EyeDropper API exists (Chromium).
- Bind boolean and number inputs with `[prop]="…"` (`[required]="true"`).
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: alpha

#### Angular
```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { TextValueAccessor, ZColorPicker, ZStack } from '@zelviora/angular';

/** An opacity slider; the value is always #rrggbbaa (8 digits). */
@Component({
  selector: 'demo-color-picker-alpha',
  imports: [FormsModule, TextValueAccessor, ZColorPicker, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-color-picker label="Overlay color" [alpha]="true" [(ngModel)]="value"></z-color-picker>
      <span>Value: {{ value }}</span>
    </z-stack>
  `,
})
export class ColorPickerAlpha {
  value = '#2563eb80';
}

```

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZColorPicker, ZStack } from '@zelviora/angular';

/** The app owns `value` (model event zInput, every drag step); the preview follows live and zChange is logged on commit. */
@Component({
  selector: 'demo-color-picker-controlled',
  imports: [ZButton, ZColorPicker, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-color-picker
        label="Background color"
        [value]="value()"
        (zInput)="value.set($event.detail.value)"
        (zChange)="add('zChange ' + $event.detail.value)"
        (zOpenChange)="add('zOpenChange ' + $event.detail.open + ' (' + $event.detail.reason + ')')"
      ></z-color-picker>
      <z-color-picker label="Preview" [value]="value()" [readonly]="true"></z-color-picker>
      <z-stack orientation="horizontal" gap="sm" [wrap]="true">
        <z-button variant="outline" tone="neutral" (click)="value.set('#dc2626')">Set #dc2626</z-button>
        <z-button variant="outline" tone="neutral" (click)="value.set('')">Clear</z-button>
      </z-stack>
      <span>Value: {{ value() || "''" }}</span>
      <output>{{ log().join(' · ') }}</output>
    </z-stack>
  `,
})
export class ColorPickerControlled {
  readonly value = signal('#7c3aed');
  readonly log = signal<string[]>([]);

  add(line: string) {
    this.log.update((l) => [line, ...l].slice(0, 5));
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZColorPicker } from '@zelviora/angular';

/** Component tokens resize the panel, the area and the swatches: see the `demo-color-picker-brand` rule in README. */
@Component({
  selector: 'demo-color-picker-customization',
  imports: [ZColorPicker],
  template: `
    <z-color-picker class="demo-color-picker-brand" label="Tag color" [inline]="true" value="#16a34a" [swatches]="swatches"></z-color-picker>
  `,
})
export class ColorPickerCustomization {
  readonly swatches = ['#0f172a', '#2563eb', '#16a34a', '#f59e0b', '#dc2626', '#db2777'];
}

```

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { TextValueAccessor, ZColorPicker, ZStack } from '@zelviora/angular';

/**
 * Click the trigger: drag in the area, move the hue slider or type a hex code.
 * `[(ngModel)]` through TextValueAccessor (model event `zInput`, every drag step).
 */
@Component({
  selector: 'demo-color-picker-default',
  imports: [FormsModule, TextValueAccessor, ZColorPicker, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-color-picker label="Primary color" [(ngModel)]="value"></z-color-picker>
      <span>Value: {{ value || "''" }}</span>
    </z-stack>
  `,
})
export class ColorPickerDefault {
  value = '#2563eb';
}

```

### Case: form

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZColorPicker, ZField, ZStack } from '@zelviora/angular';

/**
 * Native form: the value is submitted as #rrggbb (FormData), required inside a field, reset restores defaults.
 * FormsModule is not imported, so the form stays native and the element submits its own FormData entry.
 */
@Component({
  selector: 'demo-color-picker-form',
  imports: [ZButton, ZColorPicker, ZField, ZStack],
  template: `
    <form class="demo-narrow" (submit)="submit($event)">
      <z-stack>
        <z-field label="Label color" hint="Used for category tags" [required]="true">
          <z-color-picker name="label" placeholder="No color selected" [required]="true"></z-color-picker>
        </z-field>
        <z-color-picker name="theme" label="Theme color" value="#0d9488"></z-color-picker>
        <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
          <z-button type="submit">Submit</z-button>
          <z-button type="reset" variant="outline" tone="neutral">Reset</z-button>
        </z-stack>
        @if (sent()) {
          <output>{{ sent() }}</output>
        }
      </z-stack>
    </form>
  `,
})
export class ColorPickerForm {
  readonly sent = signal('');

  submit(e: Event) {
    e.preventDefault();
    this.sent.set(JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]));
  }
}

```

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZColorPicker, ZConfigProvider, ZGrid } from '@zelviora/angular';

/** Slider, area and button labels follow the locale; the panel is mirrored in RTL. */
@Component({
  selector: 'demo-color-picker-i18n',
  imports: [ZColorPicker, ZConfigProvider, ZGrid],
  template: `
    <z-grid columns="1 sm:3" gap="md">
      <z-config-provider locale="vi">
        <z-color-picker label="Tiếng Việt" value="#2563eb"></z-color-picker>
      </z-config-provider>
      <z-config-provider locale="en">
        <z-color-picker label="English" value="#2563eb"></z-color-picker>
      </z-config-provider>
      <div dir="rtl" lang="ar-EG">
        <z-color-picker label="العربية" value="#2563eb"></z-color-picker>
      </div>
    </z-grid>
  `,
})
export class ColorPickerI18n {}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZColorPicker, ZGrid } from '@zelviora/angular';

/** Empty (placeholder), filled, clearable, disabled, readonly and invalid; a status shown on the trigger. */
@Component({
  selector: 'demo-color-picker-states',
  imports: [ZColorPicker, ZGrid],
  template: `
    <z-grid columns="1 sm:2" gap="md">
      <z-color-picker label="Empty" placeholder="No color selected"></z-color-picker>
      <z-color-picker label="With value" value="#f97316"></z-color-picker>
      <z-color-picker label="Clearable" value="#f97316" [clearable]="true"></z-color-picker>
      <z-color-picker label="Disabled" value="#f97316" [disabled]="true"></z-color-picker>
      <z-color-picker label="Readonly" value="#f97316" [readonly]="true"></z-color-picker>
      <z-color-picker label="Invalid" value="#f97316" [invalid]="true"></z-color-picker>
      <z-color-picker label="Warning" value="#f97316" status="warning"></z-color-picker>
      <z-color-picker label="Success" value="#f97316" status="success"></z-color-picker>
    </z-grid>
  `,
})
export class ColorPickerStates {}

```

### Case: swatches

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZColorPicker, ZGrid } from '@zelviora/angular';

const BRAND = ['#0f172a', '#2563eb', '#16a34a', '#f59e0b', '#dc2626', '#db2777', '#7c3aed', '#0d9488'];
/** 40 hues around the wheel (long content, D-14). */
const MANY = [
  '#d92626', '#d94126', '#d95c26', '#d97726', '#d99126', '#d9ac26', '#d9c726', '#d0d926', '#b5d926', '#9ad926',
  '#80d926', '#65d926', '#4ad926', '#2fd926', '#26d938', '#26d953', '#26d96e', '#26d988', '#26d9a3', '#26d9be',
  '#26d9d9', '#26bed9', '#26a3d9', '#2688d9', '#266ed9', '#2653d9', '#2638d9', '#2f26d9', '#4a26d9', '#6526d9',
  '#7f26d9', '#9a26d9', '#b526d9', '#d026d9', '#d926c7', '#d926ac', '#d92691', '#d92677', '#d9265c', '#d92641',
];

/** Preset colors as a radio group (arrow keys move, Space/Enter picks); the selected swatch is announced. */
@Component({
  selector: 'demo-color-picker-swatches',
  imports: [ZColorPicker, ZGrid],
  template: `
    <z-grid columns="1 md:2" gap="md">
      <z-color-picker label="Brand palette" [inline]="true" value="#2563eb" [swatches]="brand"></z-color-picker>
      <z-color-picker label="40 colors" value="#d92626" [swatches]="many"></z-color-picker>
    </z-grid>
  `,
})
export class ColorPickerSwatches {
  readonly brand = BRAND;
  readonly many = MANY;
}

```

### Case: validation

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZColorPicker, ZStack } from '@zelviora/angular';

/** A required color, and a wrong hex code (type "#12" then leave the field) that stays as bad input. */
@Component({
  selector: 'demo-color-picker-validation',
  imports: [ZButton, ZColorPicker, ZStack],
  template: `
    <form class="demo-narrow" (submit)="$event.preventDefault()">
      <z-stack>
        <z-color-picker name="brand" label="Brand color" placeholder="No color selected" [required]="true"></z-color-picker>
        <z-color-picker name="accent" label="Try an invalid hex code" value="#0ea5e9" hint='Type "#12" in the hex field, then Tab'></z-color-picker>
        <z-button type="submit">Submit</z-button>
      </z-stack>
    </form>
  `,
})
export class ColorPickerValidation {}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZColorPicker, ZGrid, ZStack } from '@zelviora/angular';

/** Outline and filled triggers in every size, and the panel in the flow (`inline`). */
@Component({
  selector: 'demo-color-picker-variants',
  imports: [ZColorPicker, ZGrid, ZStack],
  template: `
    <z-stack gap="lg">
      <z-grid columns="1 sm:3" gap="md">
        <z-color-picker label="Small" size="sm" value="#2563eb"></z-color-picker>
        <z-color-picker label="Medium" size="md" value="#2563eb"></z-color-picker>
        <z-color-picker label="Large" size="lg" value="#2563eb"></z-color-picker>
        <z-color-picker label="Small filled" size="sm" variant="filled" value="#16a34a"></z-color-picker>
        <z-color-picker label="Medium filled" size="md" variant="filled" value="#16a34a"></z-color-picker>
        <z-color-picker label="Large filled" size="lg" variant="filled" value="#16a34a"></z-color-picker>
      </z-grid>
      <z-color-picker label="Inline" [inline]="true" value="#db2777"></z-color-picker>
    </z-stack>
  `,
})
export class ColorPickerVariants {}

```


================================================================================
# COMPONENT: COMBO-CHART
================================================================================

## Documentation

# Combo chart (`<z-combo-chart>`)

Composite multi-series chart combining bars, lines, areas, and dual Y axes in a single plot.

## Installation & Import

```tsx
// React (@zelviora/react-chart)
import { ZComboChart } from '@zelviora/react-chart';

// Vue 3 (@zelviora/vue-chart)
import { ZComboChart } from '@zelviora/vue-chart';

// Angular (@zelviora/angular-chart)
import { ZComboChart } from '@zelviora/angular-chart';

// Web Components (@zelviora/chart)
import '@zelviora/chart';
```

## Key Features

- **Tree-shaken ECharts 6 Core**: Automatically registers only the required ECharts chart module and components.
- **Design System Token Synchronization**: Reads `--z-chart-series-1..8`, `--z-chart-grid-color`, and `--z-chart-axis-color`, reacting automatically to Light/Dark mode and theme preset changes.
- **Built-in Accessibility (WCAG AAA)**: Renders a semantic `<figure>` with `<figcaption>`, interactive `aria-pressed` legend toggles, and a synchronized `<table>` for screen readers.
- **Escape Hatch (`option`)**: Deep-merges any raw ECharts `option` object on top of the declarative props.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZComboChart } from '@zelviora/angular-chart';
import { comboData, comboSeries } from '../data';

@Component({
  selector: 'demo-combo-chart-basic',
  imports: [ZComboChart],
  template: `
    <z-combo-chart
      heading="Revenue vs Operating Margin (%)"
      description="Quarterly revenue bars paired with a secondary-axis operating margin trend line."
      xKey="quarter" [data]="data" [series]="series"
    ></z-combo-chart>
  `,
})
export class ComboChartBasic {
  readonly data = comboData;
  readonly series = comboSeries;
}

```

### Case: controlled

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/angular';
import { ZComboChart, type ChartPointSelectDetail, type ChartSeriesToggleDetail } from '@zelviora/angular-chart';
import { comboData, comboSeries } from '../data';

@Component({
  selector: 'demo-combo-chart-controlled',
  imports: [ZStack, ZButton, ZBadge, ZText, ZComboChart],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <z-button size="sm" variant="outline" (click)="hidden = []">
          Show All Series
        </z-button>
        <z-badge tone="primary" variant="soft">{{ selected }}</z-badge>
        <z-text variant="muted" size="sm">
          Hidden: {{ hidden.length ? hidden.join(', ') : 'none' }}
        </z-text>
      </z-stack>
      <z-combo-chart
        heading="Revenue vs Operating Margin (%) (Interactive)"
        description="Quarterly revenue bars paired with a secondary-axis operating margin trend line."
        xKey="quarter" [data]="data" [series]="series"
        [selectable]="true"
        [hiddenSeries]="hidden"
        (zSeriesToggle)="onToggle($event)"
        (zPointSelect)="onSelect($event)"
      ></z-combo-chart>
    </z-stack>
  `,
})
export class ComboChartControlled {
  readonly data = comboData;
  readonly series = comboSeries;
  hidden: string[] = [];
  selected = 'Click any chart element to inspect';

  onToggle(e: CustomEvent<ChartSeriesToggleDetail>) {
    this.hidden = e.detail.hiddenSeries;
  }

  onSelect(e: CustomEvent<ChartPointSelectDetail>) {
    this.selected = `Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`;
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZComboChart } from '@zelviora/angular-chart';
import { comboData, comboSeries } from '../data';

@Component({
  selector: 'demo-combo-chart-customization',
  imports: [ZComboChart],
  template: `
    <z-combo-chart
      class="demo-chart-brand"
      description="Quarterly revenue bars paired with a secondary-axis operating margin trend line."
      [valueFormat]="{ maximumFractionDigits: 1 }"
      xKey="quarter" [data]="data" [series]="series" [smooth]="true" [dataZoom]="true" renderer="canvas"
    >
      <span slot="heading">Revenue vs Operating Margin (%) — Custom Theme Tokens &amp; Canvas</span>
    </z-combo-chart>
  `,
})
export class ComboChartCustomization {
  readonly data = comboData;
  readonly series = comboSeries;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZComboChart } from '@zelviora/angular-chart';
import { comboData, comboSeries } from '../data';

@Component({
  selector: 'demo-combo-chart-states',
  imports: [ZStack, ZComboChart],
  template: `
    <z-stack gap="lg">
      <z-combo-chart
        heading="Loading State (aria-busy)"
        [loading]="true"
        xKey="quarter" [data]="data" [series]="series"
      ></z-combo-chart>
      <z-combo-chart
        heading="Empty State"
        [data]="[]"
        [series]="series"
      ></z-combo-chart>
      <z-combo-chart
        heading="Expanded Accessible Data Table"
        description="Quarterly revenue bars paired with a secondary-axis operating margin trend line."
        [showDataTable]="true"
        xKey="quarter" [data]="data" [series]="series"
      ></z-combo-chart>
    </z-stack>
  `,
})
export class ComboChartStates {
  readonly data = comboData;
  readonly series = comboSeries;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZComboChart } from '@zelviora/angular-chart';
import { comboData, comboSeries } from '../data';

@Component({
  selector: 'demo-combo-chart-variants',
  imports: [ZStack, ZComboChart],
  template: `
    <z-stack gap="lg">
      <z-combo-chart
        heading="Stacked Bars + Smooth Line"
        description="Stacked bars with smooth dual-axis line vs interactive dataZoom composite chart."
        xKey="quarter" [data]="data" [series]="series" [stacked]="true" [smooth]="true"
      ></z-combo-chart>
      <z-combo-chart
        heading="Zoomable Dual-Axis Combo"
        description="Stacked bars with smooth dual-axis line vs interactive dataZoom composite chart."
        xKey="quarter" [data]="data" [series]="series" [dataZoom]="true"
      ></z-combo-chart>
    </z-stack>
  `,
})
export class ComboChartVariants {
  readonly data = comboData;
  readonly series = comboSeries;
}

```


================================================================================
# COMPONENT: COMBOBOX
================================================================================

## Documentation

# combobox — Angular

Processed requirements of [`<z-combobox>` (options declared with `<z-select-option>` / `<z-select-group>`)](../../../../../requirements/04-components/form/combobox.md)
for Angular (`@zelviora/angular`).

## Usage

```html
<z-combobox name="province" label="City" [(ngModel)]="province">
  <z-select-option value="hn">Amsterdam</z-select-option>
  <z-select-option value="dn">Lisbon</z-select-option>
</z-combobox>
```

## Binding

| Value accessor | Model | Event | Detail |
|---|---|---|---|
| `SelectValueAccessor` | `[(ngModel)]` / `formControl` (`string | null`) | `(zChange)` | `{ value, option }` |
| — | `[open]` (no two-way binding, D-031) | `(zOpenChange)` | `{ open, reason }` |

## Events

`(zSearch)`, `(zChange)`, `(zOpenChange)`, `(zBeforeOpen)`, `(zBeforeClose)`, `(zClear)`, `(zLoadMore)`, `(zAfterOpen)`, `(zAfterClose)`.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `combobox-default.ts` | D-1 Default, D-9 Controlled (event log), D-15 Keyboard|
| `form` | `combobox-form.ts` | D-10 In form (value, not text), D-8 Error (required), D-17 Composition (field) |
| `async` | `combobox-async.ts` | D-22 Async (search event, debounce 300 ms, load more), D-20 Loading |
| `custom` | `combobox-custom.ts` | D-23 Custom value, D-18 Customization (`::part(item-match)`), D-20 Empty |
| `large` | `combobox-large.ts` | D-14 Long content (5 000 options, `virtual` auto) |
| `i18n` | `combobox-i18n.ts` | D-19 i18n|

## Differences

- Boolean, number, array and function props are bound with `[prop]="…"` so the value reaches the element with its type.
- `virtual` (`auto` above 200 options after filtering, `on`, `off`) renders only the options in view; the load-more event works with or without it.
- The typed text (`inputValue`) is not a controlled / two-way value: listen to the search event.
- Form reset does not emit events: reset the bound value yourself.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: async

#### Angular
```typescript
import { Component, type OnDestroy, computed, signal } from '@angular/core';
import { ZCombobox, ZStack } from '@zelviora/angular';

/** Shape of the `options` property (ZSelectOptionData of the core package). */
type Opt = { value: string; label: string };

const STREETS = ['Main Street', 'Oak Avenue', 'Maple Drive', 'Park Lane', 'Cedar Road', 'Elm Court'];
/** Fixed fake dataset: 120 addresses. */
const DATA: Opt[] = Array.from({ length: 120 }, (_, i) => ({ value: `a${i + 1}`, label: `${i + 1} ${STREETS[i % STREETS.length]}` }));
const PAGE = 20;
const fold = (s: string) => s.normalize('NFD').replace(/\p{Mn}/gu, '').toLowerCase();
const search = (q: string) => DATA.filter((o) => fold(o.label).includes(fold(q)));

/** The app filters (filter="none"): zSearch debounced 300 ms, loading while waiting, zLoadMore adds the next page. */
@Component({
  selector: 'demo-combobox-async',
  imports: [ZCombobox, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-combobox
        label="Address"
        hint="Results come from the app; scroll to the end to load more"
        filter="none"
        [loading]="loading()"
        [options]="shown()"
        (zSearch)="onSearch($event.detail.query)"
        (zLoadMore)="onLoadMore()"
      ></z-combobox>
      <span>{{ results().length }} matches, {{ shown().length }} shown</span>
    </z-stack>
  `,
})
export class ComboboxAsync implements OnDestroy {
  readonly query = signal('');
  readonly page = signal(1);
  readonly loading = signal(false);
  readonly results = computed(() => search(this.query()));
  readonly shown = computed(() => this.results().slice(0, this.page() * PAGE));
  private timer?: ReturnType<typeof setTimeout>;

  private later(fn: () => void) {
    clearTimeout(this.timer);
    this.loading.set(true);
    this.timer = setTimeout(() => { fn(); this.loading.set(false); }, 300);
  }

  onSearch(q: string) {
    this.later(() => { this.query.set(q); this.page.set(1); });
  }

  onLoadMore() {
    if (this.page() * PAGE < this.results().length) this.later(() => this.page.update((p) => p + 1));
  }

  ngOnDestroy() {
    clearTimeout(this.timer);
  }
}

```

### Case: custom

#### Angular
```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SelectValueAccessor, ZCombobox, ZSelectOption, ZStack } from '@zelviora/angular';

const JOBS = ['Software engineer', 'Teacher', 'Doctor', 'Accountant', 'Designer'];

/** Custom value (allow-custom-value), matched text styled through ::part(item-match), custom empty content. */
@Component({
  selector: 'demo-combobox-custom',
  imports: [FormsModule, SelectValueAccessor, ZCombobox, ZSelectOption, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-combobox label="Occupation" hint="Type a job that is not listed, then Enter or leave the field" [allowCustomValue]="true" [clearable]="true" [(ngModel)]="job">
        @for (j of jobs; track j) {
          <z-select-option [value]="j">{{ j }}</z-select-option>
        }
      </z-combobox>
      <span>Value: {{ job ?? 'none' }}</span>
      <z-combobox class="demo-combobox-match" label="Matched text underlined">
        @for (j of jobs; track j) {
          <z-select-option [value]="j">{{ j }}</z-select-option>
        }
        <span slot="empty">No job matches; try "eng"</span>
      </z-combobox>
    </z-stack>
  `,
})
export class ComboboxCustom {
  readonly jobs = JOBS;
  job: string | null = null;
}

```

### Case: default

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SelectValueAccessor, ZCombobox, ZSelectOption, ZStack } from '@zelviora/angular';

const PROVINCES: Array<[string, string]> = [
  ['hn', 'Amsterdam'], ['hp', 'Berlin'], ['qn', 'Chicago'], ['hg', 'Dublin'], ['lc', 'Edinburgh'],
  ['th', 'Florence'], ['na', 'Geneva'], ['hue', 'Helsinki'], ['dn', 'Lisbon'], ['qnam', 'Madrid'],
  ['kh', 'Oslo'], ['ld', 'Prague'], ['dl', 'Quebec City'], ['gl', 'Rotterdam'], ['hcm', 'Seattle'],
  ['bd', 'Toronto'], ['dnai', 'Vienna'], ['ct', 'Warsaw'], ['ag', 'Zurich'], ['cm', 'Cardiff'],
];

/** `[(ngModel)]` through SelectValueAccessor (model event `zChange`); event log; typing "da nang" finds "Lisbon". */
@Component({
  selector: 'demo-combobox-default',
  imports: [FormsModule, SelectValueAccessor, ZCombobox, ZSelectOption, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-combobox
        label="City"
        hint='Type part of a name, for example "lis"'
        placeholder="Type to search"
        [clearable]="true"
        [(ngModel)]="value"
        (zChange)="add('zChange ' + $event.detail.value)"
        (zSearch)="add('zSearch ' + $event.detail.query)"
      >
        @for (p of provinces; track p[0]) {
          <z-select-option [value]="p[0]">{{ p[1] }}</z-select-option>
        }
      </z-combobox>
      <span>Value: {{ value ?? 'none' }}</span>
      <output>{{ log().join(' · ') }}</output>
    </z-stack>
  `,
})
export class ComboboxDefault {
  readonly provinces = PROVINCES;
  value: string | null = 'dn';
  readonly log = signal<string[]>([]);

  add(line: string) {
    this.log.update((l) => [line, ...l].slice(0, 4));
  }
}

```

### Case: form

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZCombobox, ZField, ZSelectOption, ZStack } from '@zelviora/angular';

const PROVINCES: Array<[string, string]> = [
  ['hn', 'Amsterdam'], ['hp', 'Berlin'], ['qn', 'Chicago'], ['hg', 'Dublin'], ['lc', 'Edinburgh'],
  ['th', 'Florence'], ['na', 'Geneva'], ['hue', 'Helsinki'], ['dn', 'Lisbon'], ['qnam', 'Madrid'],
  ['kh', 'Oslo'], ['ld', 'Prague'], ['dl', 'Quebec City'], ['gl', 'Rotterdam'], ['hcm', 'Seattle'],
  ['bd', 'Toronto'], ['dnai', 'Vienna'], ['ct', 'Warsaw'], ['ag', 'Zurich'], ['cm', 'Cardiff'],
];

/**
 * Native form: the value of the chosen option is submitted (not the text); required inside a field; reset.
 * FormsModule is not imported, so the form stays native and the element submits its own FormData entries.
 */
@Component({
  selector: 'demo-combobox-form',
  imports: [ZButton, ZCombobox, ZField, ZSelectOption, ZStack],
  template: `
    <form class="demo-narrow" (submit)="submit($event)">
      <z-stack>
        <z-field label="City" hint="Required" [required]="true">
          <z-combobox name="province" [required]="true" placeholder="Type to search">
            @for (p of provinces; track p[0]) {
              <z-select-option [value]="p[0]">{{ p[1] }}</z-select-option>
            }
          </z-combobox>
        </z-field>
        <z-combobox name="hometown" label="Hometown" value="hue">
          @for (p of provinces; track p[0]) {
            <z-select-option [value]="p[0]">{{ p[1] }}</z-select-option>
          }
        </z-combobox>
        <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
          <z-button type="submit">Submit</z-button>
          <z-button type="reset" variant="outline" tone="neutral">Reset</z-button>
        </z-stack>
        @if (sent()) {
          <output>{{ sent() }}</output>
        }
      </z-stack>
    </form>
  `,
})
export class ComboboxForm {
  readonly provinces = PROVINCES;
  readonly sent = signal('');

  submit(e: Event) {
    e.preventDefault();
    this.sent.set(JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]));
  }
}

```

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCombobox, ZConfigProvider } from '@zelviora/angular';
import { provinces } from '../data-i18n';

/** With locale `vi` the search ignores accents ("da nang" finds "Đà Nẵng") and the built-in texts are Vietnamese. */
@Component({
  selector: 'demo-combobox-i18n',
  imports: [ZCombobox, ZConfigProvider],
  template: `
    <z-config-provider locale="vi">
      <div class="demo-narrow">
        <z-combobox label="Tỉnh/thành" hint='Gõ không dấu, ví dụ "da nang"' placeholder="Gõ để tìm" [clearable]="true" [options]="provinces"></z-combobox>
      </div>
    </z-config-provider>
  `,
})
export class ComboboxI18n {
  readonly provinces = provinces;
}

```

### Case: large

#### Angular
```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SelectValueAccessor, ZCombobox, ZStack } from '@zelviora/angular';

/** 5 000 options as data: the list is virtual (`virtual="auto"` above 200 options), only the rows in view are rendered. */
@Component({
  selector: 'demo-combobox-large',
  imports: [FormsModule, SelectValueAccessor, ZCombobox, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-combobox label="Product" placeholder="Type a number, for example 4321" [options]="products" [clearable]="true" [(ngModel)]="value"></z-combobox>
      <span>Value: {{ value ?? 'none' }}</span>
    </z-stack>
  `,
})
export class ComboboxLarge {
  readonly products = Array.from({ length: 5000 }, (_, i) => ({ value: `sku-${i + 1}`, label: `Product ${i + 1}` }));
  value: string | null = null;
}

```


================================================================================
# COMPONENT: COMMAND-PALETTE
================================================================================

## Documentation

# command-palette — Angular

Processed requirements of [`<z-command-palette>`](../../../../../requirements/04-components/overlay-feedback/command-palette.md) for Angular (`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```html
<z-command-palette hotkey="Mod+K" (zSelect)="run($event.detail.value)">
  <z-button slot="trigger">Commands</z-button>
  <z-command-group heading="Navigation">
    <z-command-item value="settings" shortcut="Mod+,">Settings</z-command-item>
  </z-command-group>
</z-command-palette>
```

## Binding

`[inputValue]` + `(zInput)` (`$event.detail.inputValue`); `[open]` + `(zOpenChange)`.

## Events

`(zSelect)` (cancelable: keeps it open), `(zInput)`, `(zSearch)` (debounced 300 ms, for async results), `(zBeforeOpen)`, `(zBeforeClose)` (cancelable), `(zOpenChange)` (`reason` includes `hotkey` and `select`).

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `command-palette-default.ts` | D-1 Default, D-6/D-7 disabled item, D-15 hotkey, D-17 shortcuts |
| `inline` | `command-palette-inline.ts` | D-3 Variants (inline), D-20 empty / loading, D-21 Async |
| `i18n` | `command-palette-i18n.ts` | D-19 i18n ("dong" matches the Vietnamese "close tab" command) |

## Differences

- Known as `Command` (shadcn/cmdk), "Spotlight" or "⌘K menu" elsewhere; `inline` serves search pages.
- The hotkey is off unless `hotkey` is set (KB-9), and it does not fire while typing in another field. Avoid browser shortcuts (Mod+T, Mod+W, Mod+L…).
- The data type of `items` is `ZCommandPaletteItem` (spec name `ZCommandItem` clashes with the item element type).


## Examples & Implementation

### Case: default

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZCommandGroup, ZCommandItem, ZCommandPalette, ZStack, ZText } from '@zelviora/angular';

/** Dialog opened by its trigger or the Mod+K hotkey (off unless set). */
@Component({
  selector: 'demo-command-palette-default',
  imports: [ZButton, ZCommandGroup, ZCommandItem, ZCommandPalette, ZStack, ZText],
  template: `
    <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="md">
      <z-command-palette hotkey="Mod+K" (zSelect)="last.set($event.detail.item.label)">
        <z-button slot="trigger" variant="outline" tone="neutral">Commands (Ctrl/⌘ K)</z-button>
        <z-command-group heading="Navigation">
          <z-command-item value="dashboard" shortcut="Mod+1">Dashboard</z-command-item>
          <z-command-item value="settings" keywords="preferences,options" shortcut="Mod+,">Settings</z-command-item>
          <z-command-item value="billing" [disabled]="true">Billing</z-command-item>
        </z-command-group>
        <z-command-group heading="Actions">
          <z-command-item value="new-project">New project</z-command-item>
          <z-command-item value="theme" keywords="dark,light">Toggle theme</z-command-item>
          <z-command-item value="close-tab">Close tab</z-command-item>
        </z-command-group>
        <span slot="footer">↑↓ to move · Enter to run · Esc to close</span>
      </z-command-palette>
      <z-text variant="muted">Last command: {{ last() }}</z-text>
    </z-stack>
  `,
})
export class CommandPaletteDefault {
  readonly last = signal('nothing yet');
}

```

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZCommandGroup, ZCommandItem, ZCommandPalette } from '@zelviora/angular';

/** `lang="vi"`: labels and built-in texts are Vietnamese; "dong" matches "Đóng tab". */
@Component({
  selector: 'demo-command-palette-i18n',
  imports: [ZButton, ZCommandGroup, ZCommandItem, ZCommandPalette],
  template: `
    <z-command-palette lang="vi">
      <z-button slot="trigger" variant="outline" tone="neutral">Lệnh</z-button>
      <z-command-group heading="Thao tác">
        <z-command-item value="new-project">Dự án mới</z-command-item>
        <z-command-item value="settings" keywords="cai dat">Cài đặt</z-command-item>
        <z-command-item value="close-tab">Đóng tab</z-command-item>
      </z-command-group>
    </z-command-palette>
  `,
})
export class CommandPaletteI18n {}

```

### Case: inline

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import type { ZCommandPaletteItem } from '@zelviora/core';
import { ZCommandPalette } from '@zelviora/angular';

const ALL: ZCommandPaletteItem[] = [
  { value: 'invoices', label: 'Invoices', group: 'Pages' },
  { value: 'customers', label: 'Customers', group: 'Pages', keywords: ['clients'] },
  { value: 'reports', label: 'Reports', group: 'Pages' },
  { value: 'export', label: 'Export as CSV', group: 'Actions', shortcut: 'Mod+E' },
  { value: 'archive', label: 'Archive selection', group: 'Actions' },
];

/** Inline search with results from a (fake) server: zSearch is debounced, loading shows a spinner, no client filter. */
@Component({
  selector: 'demo-command-palette-inline',
  imports: [ZCommandPalette],
  template: `
    <div class="demo-narrow">
      <z-command-palette
        [inline]="true"
        label="Search the workspace"
        [disableFilter]="true"
        [items]="items()"
        [loading]="loading()"
        (zSearch)="search($event.detail.query)"
      >
        <span slot="empty">Nothing found. Try “clients”.</span>
      </z-command-palette>
    </div>
  `,
})
export class CommandPaletteInline {
  readonly items = signal(ALL);
  readonly loading = signal(false);

  search(query: string) {
    const q = query.trim().toLowerCase();
    this.loading.set(true);
    setTimeout(() => {
      this.items.set(ALL.filter((i) => !q || i.label.toLowerCase().includes(q) || i.keywords?.some((k) => k.includes(q))));
      this.loading.set(false);
    }, 400);
  }
}

```


================================================================================
# COMPONENT: CONDITION-BUILDER
================================================================================

## Documentation

# Condition Builder Angular Demos

Demo cases for `<z-condition-builder>` in Angular.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import {
  ZButton,
  ZConditionBuilder,
  ZConditionBuilderExpression,
  ZConditionBuilderPredicate,
  ZIcon,
  ZIconButton,
  ZInput,
  ZText,
} from '@zelviora/angular';

interface ConditionItem {
  id: string;
  field: string;
  operator: string;
  value: string;
}

const OPERATORS = [
  { label: 'Equals', value: 'eq' },
  { label: 'Not equals', value: 'neq' },
  { label: 'Contains', value: 'contains' },
  { label: 'Starts with', value: 'starts_with' },
];

@Component({
  selector: 'demo-condition-builder-basic',
  imports: [
    ZButton,
    ZConditionBuilder,
    ZConditionBuilderPredicate,
    ZConditionBuilderExpression,
    ZIcon,
    ZIconButton,
    ZInput,
    ZText,
  ],
  template: `
    <z-condition-builder>
      <z-condition-builder-predicate condition-operator="and" [vertical]="true">
        @if (conditions().length === 0) {
          <z-text variant="muted" size="sm">No conditions defined.</z-text>
        } @else {
          @for (item of conditions(); track item.id) {
            <z-condition-builder-expression
              [operators]="operators"
              [operatorValue]="item.operator"
              (zOperatorChange)="updateOperator(item.id, $event.detail.value)"
            >
              <z-input
                [placeholder]="'Enter ' + item.field.toLowerCase()"
                [value]="item.value"
                class="demo-cb-input"
                (zInput)="updateValue(item.id, $event)"
              ></z-input>
              <z-icon-button
                label="Delete condition"
                variant="ghost"
                tone="destructive"
                size="sm"
                (click)="removeCondition(item.id)"
              >
                <z-icon name="delete"></z-icon>
              </z-icon-button>
            </z-condition-builder-expression>
          }
        }

        <div slot="end">
          <z-button size="sm" variant="outline" (click)="addCondition()">
            <z-icon slot="icon-start" name="add"></z-icon>
            Add condition
          </z-button>
        </div>
      </z-condition-builder-predicate>
    </z-condition-builder>
  `,
})
export class ConditionBuilderBasic {
  readonly operators = OPERATORS;

  readonly conditions = signal<ConditionItem[]>([
    { id: '1', field: 'Username', operator: 'eq', value: 'alex' },
    { id: '2', field: 'Email domain', operator: 'contains', value: '@example.com' },
  ]);

  addCondition() {
    this.conditions.update((prev) => [
      ...prev,
      {
        id: String(Date.now()),
        field: 'Custom filter',
        operator: 'eq',
        value: '',
      },
    ]);
  }

  removeCondition(id: string) {
    this.conditions.update((prev) => prev.filter((c) => c.id !== id));
  }

  updateOperator(id: string, operator: string) {
    this.conditions.update((prev) =>
      prev.map((c) => (c.id === id ? { ...c, operator } : c))
    );
  }

  updateValue(id: string, event: any) {
    const value = event?.target?.value ?? '';
    this.conditions.update((prev) =>
      prev.map((c) => (c.id === id ? { ...c, value } : c))
    );
  }
}

```

### Case: nested

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import {
  ZButton,
  ZConditionBuilder,
  ZConditionBuilderCompoundExpression,
  ZConditionBuilderExpression,
  ZConditionBuilderPredicate,
  ZIcon,
  ZIconButton,
  ZInput,
  ZNumberInput,
} from '@zelviora/angular';

interface Rule {
  id: string;
  operator: string;
  value: any;
}

const STRING_OPS = [
  { label: 'Equals', value: 'eq' },
  { label: 'Contains', value: 'contains' },
];

const NUM_OPS = [
  { label: 'Greater than', value: 'gt' },
  { label: 'Less than', value: 'lt' },
  { label: 'Equals', value: 'eq' },
];

@Component({
  selector: 'demo-condition-builder-nested',
  imports: [
    ZButton,
    ZConditionBuilder,
    ZConditionBuilderPredicate,
    ZConditionBuilderCompoundExpression,
    ZConditionBuilderExpression,
    ZIcon,
    ZIconButton,
    ZInput,
    ZNumberInput,
  ],
  template: `
    <z-condition-builder>
      <z-condition-builder-predicate condition-operator="and" [vertical]="true">
        @if (ageRules().length > 0) {
          <z-condition-builder-compound-expression
            field-label="Age"
            field-name="age"
            condition-operator="or"
          >
            @for (rule of ageRules(); track rule.id) {
              <z-condition-builder-expression [operators]="numOps" [operatorValue]="rule.operator">
                <z-number-input [value]="rule.value" class="demo-cb-number"></z-number-input>
                <z-icon-button
                  label="Delete condition"
                  variant="ghost"
                  tone="destructive"
                  size="sm"
                  (click)="removeAgeRule(rule.id)"
                >
                  <z-icon name="delete"></z-icon>
                </z-icon-button>
              </z-condition-builder-expression>
            }

            <div slot="end">
              <z-button size="sm" variant="ghost" (click)="addAgeRule()">
                <z-icon slot="icon-start" name="add"></z-icon>
                Add age rule
              </z-button>
            </div>
          </z-condition-builder-compound-expression>
        }

        @if (deptRules().length > 0) {
          <z-condition-builder-compound-expression
            field-label="Department"
            field-name="dept"
            condition-operator="or"
          >
            @for (rule of deptRules(); track rule.id) {
              <z-condition-builder-expression [operators]="stringOps" [operatorValue]="rule.operator">
                <z-input
                  placeholder="Department name"
                  [value]="rule.value"
                  class="demo-cb-input"
                ></z-input>
                <z-icon-button
                  label="Delete condition"
                  variant="ghost"
                  tone="destructive"
                  size="sm"
                  (click)="removeDeptRule(rule.id)"
                >
                  <z-icon name="delete"></z-icon>
                </z-icon-button>
              </z-condition-builder-expression>
            }

            <div slot="end">
              <z-button size="sm" variant="ghost" (click)="addDeptRule()">
                <z-icon slot="icon-start" name="add"></z-icon>
                Add department rule
              </z-button>
            </div>
          </z-condition-builder-compound-expression>
        }
      </z-condition-builder-predicate>
    </z-condition-builder>
  `,
})
export class ConditionBuilderNested {
  readonly stringOps = STRING_OPS;
  readonly numOps = NUM_OPS;

  readonly ageRules = signal<Rule[]>([
    { id: 'age-1', operator: 'gt', value: 18 },
    { id: 'age-2', operator: 'lt', value: 65 },
  ]);

  readonly deptRules = signal<Rule[]>([
    { id: 'dept-1', operator: 'eq', value: 'Engineering' },
    { id: 'dept-2', operator: 'eq', value: 'Product Design' },
  ]);

  addAgeRule() {
    this.ageRules.update((prev) => [
      ...prev,
      { id: `age-${Date.now()}`, operator: 'gt', value: 21 },
    ]);
  }

  removeAgeRule(id: string) {
    this.ageRules.update((prev) => prev.filter((r) => r.id !== id));
  }

  addDeptRule() {
    this.deptRules.update((prev) => [
      ...prev,
      { id: `dept-${Date.now()}`, operator: 'eq', value: '' },
    ]);
  }

  removeDeptRule(id: string) {
    this.deptRules.update((prev) => prev.filter((r) => r.id !== id));
  }
}

```


================================================================================
# COMPONENT: CONFIG-PROVIDER
================================================================================

## Documentation

# config-provider — Angular

Processed requirements of [`<z-config-provider>`](../../../../../requirements/04-components/foundation/config-provider.md)
for Angular (`@zelviora/angular`, standalone components, Angular >= 21). Related foundations:
[density](../../../../../requirements/04-components/foundation/density.md),
[RTL](../../../../../requirements/04-components/foundation/rtl.md), [i18n](../../../../../requirements/04-components/foundation/i18n.md).

## Usage

```ts
import { Component } from '@angular/core';
import { ZConfigProvider } from '@zelviora/angular';

@Component({
  selector: 'app-shell',
  imports: [ZConfigProvider],
  template: `
    <z-config-provider theme="dark" density="compact" locale="en" dir="ltr" [messages]="messages">
      <ng-content />
    </z-config-provider>
  `,
})
export class Shell { messages = { 'table.empty': 'Nothing yet' }; }
```

- `theme`, `density`, `contrast` and `motion` become `data-z-*` attributes on the provider (CSS only).
- `preset` (type `PresetName`, re-exported by the wrapper) becomes `data-z-preset`: the region takes a theme preset
  (ADR-030). Load its stylesheet once, after the tokens: `@import "@zelviora/tokens/presets/<name>.css";`. An unknown name
  is ignored; a preset whose stylesheet is not loaded keeps the default look. Both warn once in development.
- `locale`, `messages`, `size`, `variant` and `disabled` reach descendants through a context that crosses shadow roots;
  nested providers merge `messages` and inherit unset values.
- `dir` is the native HTML attribute of the provider element (not an input); bind it with `[attr.dir]` when it changes.
- Locale catalogs: `en` is built in (also published as `@zelviora/core/locales/en`, a base for writing a new catalog);
  import the Vietnamese catalog from `@zelviora/core/locales/vi` when the brand does not bundle it, and register it with
  `registerLocale('vi', vi)`.

## Binding

No model event and no value accessor (spec §12). `messages` is an object: bind it with `[messages]="…"`.

## Events

None (the internal config change is a callback, not an event).

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `config-provider-basic.ts` | D-1 Default |
| `playground` | `config-provider-playground.ts` | D-2 Playground |
| `variants` | `config-provider-variants.ts` | D-3 Variants |
| `sizes` | `config-provider-sizes.ts` | D-5 Sizes |
| `disabled` | `config-provider-disabled.ts` | D-7 Disabled |
| `runtime` | `config-provider-runtime.ts` | D-9 Controlled, D-12 Dark (locale en ↔ ar, theme light ↔ dark) |
| `form` | `config-provider-form.ts` | D-10 In form |
| `rtl` | `config-provider-rtl.ts` | D-11 RTL |
| `density` | `config-provider-density.ts` | D-16 Density (density foundation D-16) |
| `nested` | `config-provider-nested.ts` | D-17 Composition |
| `messages` | `config-provider-messages.ts` | D-18 Customization |
| `i18n` | `config-provider-i18n.ts` | D-8 Error, D-19 i18n (the only case in Vietnamese, rule L-DEMO-08) |
| `motion` | `config-provider-motion.ts` | D-21 Motion |
| `contrast` | `config-provider-contrast.ts` | D-22 High contrast (visible only when the brand enables `theme.highContrast`) |
| `preset` | `config-provider-preset.ts` | D-24 Preset (theme presets, ADR-030) |

Not yet covered: D-13 brand showcase, D-23 read config (`getConfig`, CONFIG-PROVIDER-GAP-003).

## Differences

- Angular SSR is out of scope for v1 (client only, ADR-020).
- Boolean and number props are bound with `[prop]="…"` (`[showLabel]="true"`, `[span]="3"`), so the value reaches the element with its type.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZConfigProvider, ZSpinner, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-config-provider-basic',
  imports: [ZButton, ZConfigProvider, ZSpinner, ZStack],
  template: `
    <z-config-provider>
      <z-stack orientation="horizontal" align-items="center" gap="md" [wrap]="true">
        <z-button>Save</z-button>
        <z-button variant="outline" tone="neutral">Cancel</z-button>
        <z-spinner [showLabel]="true"></z-spinner>
      </z-stack>
    </z-config-provider>
  `,
})
export class ConfigProviderBasic {}

```

### Case: contrast

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZCard, ZConfigProvider, ZGrid, ZInput, ZStack } from '@zelviora/angular';

/** `contrast="more"` next to the default region; it changes colors only when the brand enables theme.highContrast. */
@Component({
  selector: 'demo-config-provider-contrast',
  imports: [ZButton, ZCard, ZConfigProvider, ZGrid, ZInput, ZStack],
  template: `
    <z-grid columns="1 sm:2" gap="md" align-items="start">
      @for (contrast of regions; track $index) {
        <z-config-provider [contrast]="contrast">
          <z-card [heading]="contrast ? 'More contrast' : 'Default contrast'">
            <z-stack gap="sm">
              <z-input label="Email" placeholder="name@example.com" hint="We never share your email"></z-input>
              <z-stack orientation="horizontal" gap="sm" [wrap]="true">
                <z-button>Save</z-button>
                <z-button variant="outline" tone="neutral">Cancel</z-button>
              </z-stack>
            </z-stack>
          </z-card>
        </z-config-provider>
      }
    </z-grid>
  `,
})
export class ConfigProviderContrast {
  readonly regions = [undefined, 'more'] as const;
}

```

### Case: density

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZConfigProvider, ZStack, ZTable } from '@zelviora/angular';

const columns = [
  { key: 'task', header: 'Task' },
  { key: 'owner', header: 'Owner' },
];
const rows = [
  { key: '1', task: 'Review', owner: 'An' },
  { key: '2', task: 'Deploy', owner: 'Binh' },
];

@Component({
  selector: 'demo-config-provider-density',
  imports: [ZButton, ZConfigProvider, ZStack, ZTable],
  template: `
    <z-stack gap="lg">
      @for (density of densities; track density) {
        <z-config-provider [density]="density">
          <z-stack gap="sm" align-items="start">
            <z-button>{{ density }}</z-button>
            <z-table [caption]="'Tasks (' + density + ')'" [columns]="columns" [rows]="rows"></z-table>
          </z-stack>
        </z-config-provider>
      }
    </z-stack>
  `,
})
export class ConfigProviderDensity {
  readonly densities = ['compact', 'default', 'comfortable'] as const;
  readonly columns = columns;
  readonly rows = rows;
}

```

### Case: disabled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZConfigProvider, ZInput, ZSelect, ZSelectOption, ZStack, ZSwitch } from '@zelviora/angular';

/** `disabled` turns the whole region off like a disabled fieldset: no focus, no submit; the toggle stays outside. */
@Component({
  selector: 'demo-config-provider-disabled',
  imports: [ZButton, ZConfigProvider, ZInput, ZSelect, ZSelectOption, ZStack, ZSwitch],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" gap="sm" align-items="center" [wrap]="true">
        <z-button variant="outline" tone="neutral" (click)="disabled.set(!disabled())">
          {{ disabled() ? 'Enable region' : 'Disable region' }}
        </z-button>
        <span>disabled: {{ disabled() }}</span>
      </z-stack>
      <z-config-provider [disabled]="disabled()">
        <form class="demo-narrow" (submit)="submit($event)">
          <z-stack>
            <z-input label="Full name" name="name" value="An Nguyen"></z-input>
            <z-select label="Plan" name="plan" value="team">
              <z-select-option value="starter">Starter</z-select-option>
              <z-select-option value="team">Team</z-select-option>
            </z-select>
            <z-switch name="newsletter" [checked]="true">Newsletter</z-switch>
            <z-button type="submit">Submit</z-button>
            @if (sent()) {
              <output>{{ sent() }}</output>
            }
          </z-stack>
        </form>
      </z-config-provider>
    </z-stack>
  `,
})
export class ConfigProviderDisabled {
  readonly disabled = signal(true);
  readonly sent = signal('');

  submit(e: Event) {
    e.preventDefault();
    this.sent.set(JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]));
  }
}

```

### Case: form

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZConfigProvider, ZField, ZInput, ZSelect, ZSelectOption, ZStack } from '@zelviora/angular';

/**
 * A native form inside a provider with locale="en": required fields report built-in English messages on submit.
 * FormsModule is not imported, so the form stays native and the elements submit their own FormData entries.
 */
@Component({
  selector: 'demo-config-provider-form',
  imports: [ZButton, ZConfigProvider, ZField, ZInput, ZSelect, ZSelectOption, ZStack],
  template: `
    <z-config-provider locale="en">
      <form class="demo-narrow" (submit)="submit($event)">
        <z-stack>
          <z-field label="Full name" [required]="true">
            <z-input name="name" [required]="true"></z-input>
          </z-field>
          <z-field label="Email" [required]="true">
            <z-input name="email" type="email" [required]="true"></z-input>
          </z-field>
          <z-field label="Country" [required]="true">
            <z-select name="country" [required]="true">
              <z-select-option value="us">United States</z-select-option>
              <z-select-option value="gb">United Kingdom</z-select-option>
              <z-select-option value="sg">Singapore</z-select-option>
            </z-select>
          </z-field>
          <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
            <z-button type="submit">Submit</z-button>
            <z-button type="reset" variant="outline" tone="neutral">Reset</z-button>
          </z-stack>
          @if (sent()) {
            <output>{{ sent() }}</output>
          }
        </z-stack>
      </form>
    </z-config-provider>
  `,
})
export class ConfigProviderForm {
  readonly sent = signal('');

  submit(e: Event) {
    e.preventDefault();
    this.sent.set(JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]));
  }
}

```

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZCard, ZConfigProvider, ZGrid, ZInput, ZStack } from '@zelviora/angular';

/** The provider locale drives built-in strings: submit an empty form to see the validation message in each language. */
@Component({
  selector: 'demo-config-provider-i18n',
  imports: [ZButton, ZCard, ZConfigProvider, ZGrid, ZInput, ZStack],
  template: `
    <z-grid columns="1 sm:2" gap="md" align-items="start">
      <z-config-provider locale="en">
        <z-card heading="English">
          <form (submit)="$event.preventDefault()">
            <z-stack gap="sm">
              <z-input label="Full name" name="name" [required]="true"></z-input>
              <z-button type="submit">Submit</z-button>
            </z-stack>
          </form>
        </z-card>
      </z-config-provider>
      <z-config-provider locale="vi">
        <z-card heading="Tiếng Việt">
          <form (submit)="$event.preventDefault()">
            <z-stack gap="sm">
              <z-input label="Họ và tên" name="name" [required]="true"></z-input>
              <z-button type="submit">Gửi</z-button>
            </z-stack>
          </form>
        </z-card>
      </z-config-provider>
    </z-grid>
  `,
})
export class ConfigProviderI18n {}

```

### Case: messages

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZConfigProvider, ZSpinner, ZStack, ZTable } from '@zelviora/angular';

const messages = {
  'spinner.loading': 'Fetching your data',
  'table.empty': 'Nothing to show yet',
};

/** `messages` overrides library strings by key for the subtree (merged with ancestor providers). */
@Component({
  selector: 'demo-config-provider-messages',
  imports: [ZConfigProvider, ZSpinner, ZStack, ZTable],
  template: `
    <z-config-provider [messages]="messages">
      <z-stack gap="md">
        <z-spinner [showLabel]="true"></z-spinner>
        <z-table caption="Results" [columns]="columns" [rows]="[]"></z-table>
      </z-stack>
    </z-config-provider>
  `,
})
export class ConfigProviderMessages {
  readonly messages = messages;
  readonly columns = [{ key: 'name', header: 'Name' }];
}

```

### Case: motion

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCard, ZCollapsible, ZCollapsibleContent, ZCollapsibleTrigger, ZConfigProvider, ZGrid } from '@zelviora/angular';

/** `motion="reduce"` applies the reduced-motion tokens to its region only: its collapsible opens without animation. */
@Component({
  selector: 'demo-config-provider-motion',
  imports: [ZCard, ZCollapsible, ZCollapsibleContent, ZCollapsibleTrigger, ZConfigProvider, ZGrid],
  template: `
    <z-grid columns="1 sm:2" gap="md" align-items="start">
      <z-config-provider>
        <z-card heading="Default motion">
          <z-collapsible>
            <z-collapsible-trigger>Shipping details</z-collapsible-trigger>
            <z-collapsible-content>
              <p>Orders ship within two business days. Returns are accepted for 30 days.</p>
            </z-collapsible-content>
          </z-collapsible>
        </z-card>
      </z-config-provider>
      <z-config-provider motion="reduce">
        <z-card heading="Reduced motion">
          <z-collapsible>
            <z-collapsible-trigger>Shipping details</z-collapsible-trigger>
            <z-collapsible-content>
              <p>Orders ship within two business days. Returns are accepted for 30 days.</p>
            </z-collapsible-content>
          </z-collapsible>
        </z-card>
      </z-config-provider>
    </z-grid>
  `,
})
export class ConfigProviderMotion {}

```

### Case: nested

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZCard, ZConfigProvider, ZGrid, ZGridItem, ZStack, ZTable } from '@zelviora/angular';

const columns = [
  { key: 'name', header: 'Name' },
  { key: 'role', header: 'Role' },
];
const rows = [
  { key: '1', name: 'An', role: 'Admin' },
  { key: '2', name: 'Binh', role: 'Editor' },
];

/** Nested providers: a light page, a dark sidebar and a compact table region; the nearest provider wins. */
@Component({
  selector: 'demo-config-provider-nested',
  imports: [ZButton, ZCard, ZConfigProvider, ZGrid, ZGridItem, ZStack, ZTable],
  template: `
    <z-config-provider theme="light">
      <z-grid [columns]="4" align-items="start">
        <z-config-provider theme="dark">
          <z-card size="sm">
            <nav aria-label="Sidebar">
              <z-stack gap="sm">
                <z-button variant="ghost" tone="neutral">Dashboard</z-button>
                <z-button variant="ghost" tone="neutral">Reports</z-button>
              </z-stack>
            </nav>
          </z-card>
        </z-config-provider>
        <z-grid-item [span]="3">
          <z-config-provider density="compact">
            <z-table caption="Team" [columns]="columns" [rows]="rows"></z-table>
          </z-config-provider>
        </z-grid-item>
      </z-grid>
    </z-config-provider>
  `,
})
export class ConfigProviderNested {
  readonly columns = columns;
  readonly rows = rows;
}

```

### Case: playground

#### Angular
```typescript
import { Component, computed, signal } from '@angular/core';
import {
  ZButton,
  ZCard,
  ZCollapsible,
  ZCollapsibleContent,
  ZCollapsibleTrigger,
  ZConfigProvider,
  ZDatePicker,
  ZGrid,
  ZInput,
  ZSelect,
  ZSelectOption,
  ZStack,
  ZSwitch,
} from '@zelviora/angular';

/** Select controls of the playground: one provider prop each (the first option is the initial value). */
const selects = [
  { key: 'theme', label: 'Theme', options: ['light', 'dark', 'system'] },
  { key: 'density', label: 'Density', options: ['default', 'compact', 'comfortable'] },
  { key: 'size', label: 'Size', options: ['md', 'sm', 'lg'] },
  { key: 'variant', label: 'Variant', options: ['outline', 'filled'] },
  { key: 'locale', label: 'Locale', options: ['en', 'en-GB', 'ar'] },
  { key: 'dir', label: 'Direction', options: ['ltr', 'rtl'] },
] as const;
type SelectKey = (typeof selects)[number]['key'];
const initial = Object.fromEntries(selects.map((s) => [s.key, s.options[0]])) as Record<SelectKey, string>;

/** Every provider prop driven by controls built with library components, around one small sample form. */
@Component({
  selector: 'demo-config-provider-playground',
  imports: [
    ZButton,
    ZCard,
    ZCollapsible,
    ZCollapsibleContent,
    ZCollapsibleTrigger,
    ZConfigProvider,
    ZDatePicker,
    ZGrid,
    ZInput,
    ZSelect,
    ZSelectOption,
    ZStack,
    ZSwitch,
  ],
  template: `
    <z-stack gap="lg">
      <z-grid columns="2 sm:3" gap="md">
        @for (s of selects; track s.key) {
          <z-select [label]="s.label" size="sm" [value]="config()[s.key]" (zChange)="update(s.key, $any($event.detail.value))">
            @for (o of s.options; track o) {
              <z-select-option [value]="o">{{ o }}</z-select-option>
            }
          </z-select>
        }
      </z-grid>
      <z-stack orientation="horizontal" gap="md" [wrap]="true">
        <z-switch [checked]="disabled()" (zChange)="disabled.set($event.detail.checked)">Disabled</z-switch>
        <z-switch [checked]="reduceMotion()" (zChange)="reduceMotion.set($event.detail.checked)">Reduce motion</z-switch>
        <z-switch [checked]="moreContrast()" (zChange)="moreContrast.set($event.detail.checked)">More contrast</z-switch>
      </z-stack>
      <z-config-provider
        [theme]="$any(config().theme)"
        [density]="$any(config().density)"
        [size]="$any(config().size)"
        [variant]="$any(config().variant)"
        [locale]="config().locale"
        [attr.dir]="config().dir"
        [disabled]="disabled()"
        [motion]="motion()"
        [contrast]="contrast()"
      >
        <z-card heading="Sample form">
          <form class="demo-narrow" (submit)="$event.preventDefault()">
            <z-stack>
              <z-input label="Full name" name="name" [required]="true"></z-input>
              <z-select label="Plan" name="plan" value="team">
                <z-select-option value="starter">Starter</z-select-option>
                <z-select-option value="team">Team</z-select-option>
                <z-select-option value="enterprise">Enterprise</z-select-option>
              </z-select>
              <z-date-picker label="Start date" name="start" today="2026-10-02" value="2026-10-15"></z-date-picker>
              <z-collapsible>
                <z-collapsible-trigger>Plan details</z-collapsible-trigger>
                <z-collapsible-content>
                  <p>Team includes ten seats, shared projects and priority support.</p>
                </z-collapsible-content>
              </z-collapsible>
              <z-button type="submit">Submit</z-button>
            </z-stack>
          </form>
        </z-card>
      </z-config-provider>
    </z-stack>
  `,
})
export class ConfigProviderPlayground {
  readonly selects = selects;
  readonly config = signal(initial);
  readonly disabled = signal(false);
  readonly reduceMotion = signal(false);
  readonly moreContrast = signal(false);
  readonly motion = computed(() => (this.reduceMotion() ? ('reduce' as const) : undefined));
  readonly contrast = computed(() => (this.moreContrast() ? ('more' as const) : undefined));

  update(key: SelectKey, value: string | null) {
    this.config.update((c) => ({ ...c, [key]: value ?? initial[key] }));
  }
}

```

### Case: preset

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZCard, ZConfigProvider, ZGrid, ZInput, ZStack } from '@zelviora/angular';
import type { PresetName } from '@zelviora/angular';

// Each region needs the stylesheet of its preset (presets/<name>.css of the tokens package, loaded after tokens.css).
const regions: Array<{ key: string; preset: PresetName; theme?: 'dark'; title: string }> = [
  { key: 'meridian', preset: 'meridian', title: 'meridian' },
  { key: 'graphite', preset: 'graphite', title: 'graphite' },
  { key: 'meridian-dark', preset: 'meridian', theme: 'dark', title: 'meridian, dark' },
];

/** Theme presets per region: the same controls take the colors, radius, font and heights of each preset. */
@Component({
  selector: 'demo-config-provider-preset',
  imports: [ZBadge, ZButton, ZCard, ZConfigProvider, ZGrid, ZInput, ZStack],
  template: `
    <z-grid columns="1 sm:3" gap="md">
      @for (r of regions; track r.key) {
        <z-config-provider [preset]="r.preset" [theme]="r.theme">
          <z-card size="sm">
            <z-stack gap="sm">
              <z-badge tone="neutral">{{ r.title }}</z-badge>
              <z-input label="Email" placeholder="name@example.com"></z-input>
              <z-stack orientation="horizontal" gap="sm">
                <z-button>Save</z-button>
                <z-button variant="outline" tone="neutral">Cancel</z-button>
              </z-stack>
            </z-stack>
          </z-card>
        </z-config-provider>
      }
    </z-grid>
  `,
})
export class ConfigProviderPreset {
  readonly regions = regions;
}

```

### Case: rtl

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZConfigProvider, ZIcon, ZStack, ZTable } from '@zelviora/angular';

const columns = [
  { key: 'name', header: 'الاسم', pinned: 'start' as const, width: '8rem' },
  { key: 'city', header: 'المدينة' },
  { key: 'amount', header: 'المبلغ', type: 'number' as const },
];
const rows = [
  { key: 'r1', name: 'أحمد', city: 'القاهرة', amount: 1250.5 },
  { key: 'r2', name: 'ليلى', city: 'دبي', amount: 980 },
];

/** `dir` is the native attribute of the provider host; layout, alignment, pinned columns and the arrow_back icon follow it. */
@Component({
  selector: 'demo-config-provider-rtl',
  imports: [ZButton, ZConfigProvider, ZIcon, ZStack, ZTable],
  template: `
    <z-config-provider dir="rtl" lang="ar">
      <z-stack gap="md" align-items="start">
        <z-button>
          <z-icon slot="icon-start" name="arrow_back"></z-icon>
          حفظ
        </z-button>
        <z-table caption="الطلبات" [columns]="columns" [rows]="rows"></z-table>
      </z-stack>
    </z-config-provider>
  `,
})
export class ConfigProviderRtl {
  readonly columns = columns;
  readonly rows = rows;
}

```

### Case: runtime

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZCard, ZConfigProvider, ZSpinner, ZStack, ZTable } from '@zelviora/angular';

const columns = [
  { key: 'item', header: 'Item' },
  { key: 'price', header: 'Price', format: { type: 'currency' as const, currency: 'VND' } },
];
const rows = [{ key: 'a', item: 'Coffee', price: 45000 }];

/** Locale and theme switched at runtime: every descendant updates its strings and number formats in place. */
@Component({
  selector: 'demo-config-provider-runtime',
  imports: [ZButton, ZCard, ZConfigProvider, ZSpinner, ZStack, ZTable],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" gap="sm" [wrap]="true">
        <z-button variant="outline" tone="neutral" (click)="locale.set(locale() === 'en' ? 'ar' : 'en')">
          Locale: {{ locale() }}
        </z-button>
        <z-button variant="outline" tone="neutral" (click)="theme.set(theme() === 'light' ? 'dark' : 'light')">
          Theme: {{ theme() }}
        </z-button>
      </z-stack>
      <z-config-provider [locale]="locale()" [theme]="theme()">
        <!-- The card paints the themed surface, so the theme switch shows around the content. -->
        <z-card>
          <z-stack gap="md">
            <z-spinner [showLabel]="true"></z-spinner>
            <z-table caption="Order" [columns]="columns" [rows]="rows"></z-table>
            <z-table caption="Empty order" [columns]="columns" [rows]="[]"></z-table>
          </z-stack>
        </z-card>
      </z-config-provider>
    </z-stack>
  `,
})
export class ConfigProviderRuntime {
  readonly columns = columns;
  readonly rows = rows;
  readonly locale = signal<'en' | 'ar'>('en');
  readonly theme = signal<'light' | 'dark'>('light');
}

```

### Case: sizes

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZConfigProvider, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-config-provider-sizes',
  imports: [ZButton, ZConfigProvider, ZStack],
  template: `
    <z-stack gap="md" align-items="start">
      @for (size of sizes; track size) {
        <z-config-provider [size]="size">
          <z-stack orientation="horizontal" gap="sm" [wrap]="true">
            <z-button>Size {{ size }}</z-button>
            <z-button size="md" variant="outline" tone="neutral">Own size md</z-button>
          </z-stack>
        </z-config-provider>
      }
    </z-stack>
  `,
})
export class ConfigProviderSizes {
  readonly sizes = ['sm', 'md', 'lg'] as const;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZConfigProvider, ZDatePicker, ZInput, ZSelect, ZSelectOption, ZStack } from '@zelviora/angular';

/** `variant="filled"` is the default of every descendant field; a field with its own variant keeps it. */
@Component({
  selector: 'demo-config-provider-variants',
  imports: [ZConfigProvider, ZDatePicker, ZInput, ZSelect, ZSelectOption, ZStack],
  template: `
    <z-config-provider variant="filled">
      <z-stack class="demo-narrow">
        <z-input label="Full name" value="An Nguyen"></z-input>
        <z-select label="Plan" value="team">
          <z-select-option value="starter">Starter</z-select-option>
          <z-select-option value="team">Team</z-select-option>
        </z-select>
        <z-date-picker label="Start date" today="2026-10-02" value="2026-10-15"></z-date-picker>
        <z-input label="Own variant outline" variant="outline" value="Keeps its outline"></z-input>
      </z-stack>
    </z-config-provider>
  `,
})
export class ConfigProviderVariants {}

```


================================================================================
# COMPONENT: CONTAINER
================================================================================

## Documentation

# container — Angular

Processed requirements of [`<z-container>`](../../../../../requirements/04-components/layout/container.md) for Angular
(`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component } from '@angular/core';
import { ZContainer } from '@zelviora/angular';

@Component({
  selector: 'app-policy',
  imports: [ZContainer],
  template: `<z-container size="sm" landmarkRole="region" label="Shipping policy">…</z-container>`,
})
export class Policy {}
```

The container is a container query context: grids inside it respond to its content width.

## Binding

No model event, no value accessor.

## Events

None.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `container-basic.ts` | D-1 Default |
| `sizes` | `container-sizes.ts` | D-5 Sizes |
| `landmark` | `container-landmark.ts` | Landmark (`landmarkRole`, `label`) |
| `composition` | `container-composition.ts` | D-17 Composition |

Not yet covered: D-2 playground, D-11 RTL, D-12/D-13 dark and brand, D-14 long URL, D-16 density, D-18 `--z-container-max-width` (needs app CSS).

## Differences

- String props are static attributes (`size="sm"`); values from the component use property bindings (`[size]="size"`).
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZContainer } from '@zelviora/angular';

/** Default: at most 64rem wide (lg), centered, with md inline padding. */
@Component({
  selector: 'demo-container-basic',
  imports: [ZContainer],
  template: `
    <z-container>
      <p>
        A container keeps lines of text at a readable length on wide screens and adds inline padding on narrow ones. It is
        also a container query context, so grids inside it respond to its width rather than to the viewport.
      </p>
    </z-container>
  `,
})
export class ContainerBasic {}

```

### Case: composition

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCard, ZContainer, ZGrid } from '@zelviora/angular';

/** The grid columns follow the container (md, 48rem): three columns from sm, one when the container is narrower. */
@Component({
  selector: 'demo-container-composition',
  imports: [ZCard, ZContainer, ZGrid],
  template: `
    <z-container size="md">
      <z-grid columns="1 sm:3">
        @for (s of stats; track s.heading) {
          <z-card [heading]="s.heading" size="sm">{{ s.value }}</z-card>
        }
      </z-grid>
    </z-container>
  `,
})
export class ContainerComposition {
  readonly stats = [
    { heading: 'Revenue', value: '1.2B VND' },
    { heading: 'Orders', value: '3,410' },
    { heading: 'Customers', value: '982' },
  ];
}

```

### Case: landmark

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZContainer, ZStack } from '@zelviora/angular';

/** landmarkRole sets the role on the host; a region needs a label. */
@Component({
  selector: 'demo-container-landmark',
  imports: [ZContainer, ZStack],
  template: `
    <z-container size="sm" landmarkRole="region" label="Shipping policy">
      <z-stack gap="sm">
        <p>Orders ship within two business days.</p>
        <p>Returns are free for 30 days.</p>
      </z-stack>
    </z-container>
  `,
})
export class ContainerLandmark {}

```

### Case: sizes

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCard, ZContainer, ZStack } from '@zelviora/angular';

/** Maximum widths: sm 40rem, md 48rem, lg 64rem, xl 80rem, full without limit. */
@Component({
  selector: 'demo-container-sizes',
  imports: [ZCard, ZContainer, ZStack],
  template: `
    <z-stack gap="sm">
      @for (size of sizes; track size) {
        <z-container [size]="size" padding="none">
          <z-card variant="soft" size="sm">size="{{ size }}"</z-card>
        </z-container>
      }
    </z-stack>
  `,
})
export class ContainerSizes {
  readonly sizes = ['sm', 'md', 'lg', 'xl', 'full'] as const;
}

```


================================================================================
# COMPONENT: CONTEXT-MENU
================================================================================

## Documentation

# context-menu — Angular

Processed requirements of [`<z-context-menu>`](../../../../../requirements/04-components/overlay-feedback/context-menu.md)
for Angular (`@zelviora/angular`, standalone components, Angular >= 21). The items are the `z-menu-*` items of the dropdown menu.

## Usage

```ts
import { Component } from '@angular/core';
import { ZContextMenu, ZMenuItem } from '@zelviora/angular';

@Component({
  selector: 'app-file',
  imports: [ZContextMenu, ZMenuItem],
  template: `
    <z-context-menu label="File actions" (zSelect)="run($event.detail.value)">
      <div slot="target" tabindex="0">report.pdf</div>
      <z-menu-item value="open">Open</z-menu-item>
    </z-context-menu>
  `,
})
export class File { run(value: string) {} }
```

A context menu is a secondary path: every action must also be reachable another way (a button or a dropdown menu).

## Binding

| Component | Input | Event | Detail |
|---|---|---|---|
| `ZContextMenu` | `[open]` (no two-way binding, D-031) | `(zOpenChange)` | `{ open, reason }` |

`(zBeforeOpen)` (`{ reason, x, y, target }`, cancelable: `preventDefault()` keeps the browser menu), `(zBeforeClose)`
(cancelable), `(zAfterOpen)`, `(zAfterClose)`; `(zSelect)` (`{ value, item }`, cancelable) bubbles from the items.
Methods (through `viewChild(…, { read: ElementRef })`): `showAt(x, y)`, `hide()`.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `context-menu-default.ts` | D-1 Default, D-4 Tones, D-15 Keyboard-only (Shift+F10) |
| `variants` | `context-menu-variants.ts` | D-3 Variants (checkbox, radio, submenu), D-6 States (flip near edges) |
| `controlled` | `context-menu-controlled.ts` | D-9 Controlled (cancel BeforeOpen by target), D-7 Disabled, C-1 `showAt` |

## Differences

- Long-press on iOS can conflict with text selection (spec ⚠️); the demo areas set `user-select: none`.
- Boolean and number props are bound with `[prop]="…"`, so the value reaches the element with its type.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: controlled

#### Angular
```typescript
import { Component, ElementRef, signal, viewChild } from '@angular/core';
import { ZButton, ZContextMenu, ZMenuItem, ZStack } from '@zelviora/angular';

type ContextMenuEl = HTMLElement & { showAt(x: number, y: number): Promise<void> };

/**
 * zBeforeOpen cancelled on empty space (the browser menu shows there), `open` mirrored from zOpenChange, showAt() from a
 * button and a disabled context menu that keeps the browser menu.
 */
@Component({
  selector: 'demo-context-menu-controlled',
  imports: [ZButton, ZContextMenu, ZMenuItem, ZStack],
  template: `
    <z-stack gap="md">
      <z-context-menu #menu label="Row actions" [open]="open()" (zOpenChange)="open.set($event.detail.open)" (zBeforeOpen)="onBeforeOpen($event)">
        <z-stack slot="target" gap="xs" class="demo-context-area">
          <span data-file="a.txt" tabindex="0">a.txt</span>
          <span data-file="b.txt" tabindex="0">b.txt</span>
          <span>(empty space: browser menu)</span>
        </z-stack>
        <z-menu-item value="open">Open {{ file() }}</z-menu-item>
        <z-menu-item value="delete" tone="destructive">Delete {{ file() }}</z-menu-item>
      </z-context-menu>
      <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="md">
        <z-button variant="outline" tone="neutral" (click)="showFrom($event)">showAt()</z-button>
        <span>{{ open() ? 'Open' : 'Closed' }}</span>
      </z-stack>
      <z-context-menu label="Disabled" [disabled]="true">
        <div slot="target" class="demo-context-area">Disabled: the browser menu shows</div>
        <z-menu-item value="never">Never shown</z-menu-item>
      </z-context-menu>
    </z-stack>
  `,
})
export class ContextMenuControlled {
  readonly open = signal(false);
  readonly file = signal('');
  private readonly menu = viewChild.required('menu', { read: ElementRef });

  onBeforeOpen(e: CustomEvent<{ reason: string; target: EventTarget | null }>) {
    const row = (e.detail.target as Element | null)?.closest?.('[data-file]');
    if (e.detail.reason !== 'programmatic' && !row) e.preventDefault();
    else this.file.set(row?.getAttribute('data-file') ?? '');
  }

  showFrom(e: MouseEvent) {
    const r = (e.currentTarget as HTMLElement).getBoundingClientRect();
    void (this.menu().nativeElement as ContextMenuEl).showAt(r.left, r.bottom);
  }
}

```

### Case: default

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZContextMenu, ZMenuItem, ZMenuSeparator, ZStack } from '@zelviora/angular';

/** Right click, long-press (touch) or focus the area and press Shift+F10 / the Menu key. */
@Component({
  selector: 'demo-context-menu-default',
  imports: [ZContextMenu, ZMenuItem, ZMenuSeparator, ZStack],
  template: `
    <z-stack gap="sm">
      <z-context-menu label="File actions" (zSelect)="last.set($event.detail.value)">
        <div slot="target" tabindex="0" class="demo-context-area">report.pdf — right click here</div>
        <z-menu-item value="open">Open<kbd slot="shortcut">⏎</kbd></z-menu-item>
        <z-menu-item value="rename">Rename<kbd slot="shortcut">F2</kbd></z-menu-item>
        <z-menu-item value="duplicate">Duplicate</z-menu-item>
        <z-menu-item value="share" [disabled]="true">Share</z-menu-item>
        <z-menu-separator></z-menu-separator>
        <z-menu-item value="delete" tone="destructive">Delete</z-menu-item>
      </z-context-menu>
      <span>{{ last() ? 'Last action: ' + last() : 'No action yet' }}</span>
    </z-stack>
  `,
})
export class ContextMenuDefault {
  readonly last = signal('');
}

```

### Case: variants

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import {
  ZContextMenu, ZMenuCheckboxItem, ZMenuItem, ZMenuLabel, ZMenuRadioGroup, ZMenuRadioItem, ZMenuSeparator, ZMenuSub, ZStack,
} from '@zelviora/angular';

/** Checkbox and radio items (`[checked]` / `[value]` + `(zChange)`), a submenu; the menu flips near the viewport edges. */
@Component({
  selector: 'demo-context-menu-variants',
  imports: [ZContextMenu, ZMenuCheckboxItem, ZMenuItem, ZMenuLabel, ZMenuRadioGroup, ZMenuRadioItem, ZMenuSeparator, ZMenuSub, ZStack],
  template: `
    <z-stack gap="sm">
      <z-context-menu label="Canvas">
        <div slot="target" tabindex="0" class="demo-context-area">Canvas — right click near the edges too</div>
        <z-menu-checkbox-item [checked]="grid()" [keepOpenOnSelect]="true" (zChange)="grid.set($event.detail.checked)">Show grid</z-menu-checkbox-item>
        <z-menu-separator></z-menu-separator>
        <z-menu-radio-group [value]="zoom()" (zChange)="zoom.set($event.detail.value)">
          <z-menu-label>Zoom</z-menu-label>
          <z-menu-radio-item value="50">50%</z-menu-radio-item>
          <z-menu-radio-item value="100">100%</z-menu-radio-item>
          <z-menu-radio-item value="200">200%</z-menu-radio-item>
        </z-menu-radio-group>
        <z-menu-separator></z-menu-separator>
        <z-menu-sub>
          <z-menu-item slot="trigger">Arrange</z-menu-item>
          <z-menu-item value="front">Bring to front</z-menu-item>
          <z-menu-item value="back">Send to back</z-menu-item>
        </z-menu-sub>
      </z-context-menu>
      <span>Grid {{ grid() ? 'on' : 'off' }}, zoom {{ zoom() }}%</span>
    </z-stack>
  `,
})
export class ContextMenuVariants {
  readonly grid = signal(true);
  readonly zoom = signal('100');
}

```


================================================================================
# COMPONENT: CROPPER
================================================================================

## Documentation

# cropper — Angular

Processed requirements of [`<z-cropper>`](../../../../../requirements/04-components/advanced/cropper.md) for Angular
(`@zelviora/angular`, standalone components).

## Usage

```html
<z-cropper [src]="src" alt="Profile photo" [aspectRatio]="1" [value]="area()" (zInput)="area.set($event.detail.value)"></z-cropper>
```

`src` and `alt` are required inputs. The demos use an inline SVG `data:` URL (`data.ts`, generated from `documents/shared/cropper/data.ts` by `pnpm docs:data`, identical in React, Vue and Angular) so they work offline and
`getCroppedBlob()` can read the canvas; an image of another origin needs CORS and `crossorigin="anonymous"`.

## Binding and events

Object value, not form-associated: no value accessor (spec §12, `model-events.ts`); bind `[value]` + `(zInput)`
(or `(zChange)` for committed changes only).

| Input | Output | Detail |
|---|---|---|
| `[value]` (`ZCropArea`: `x`, `y`, `width`, `height` in original image pixels, `rotate`, `zoom`) | `(zInput)` while dragging / each key step | `{ value }` |
| | `(zChange)` on release, after a key step, zoom, rotation | `{ value }` |
| | `(zLoad)` | `{ naturalWidth, naturalHeight }` |
| | `(zError)` | `{ error }` |

Methods through `viewChild(ZCropper)`: `getCroppedBlob({ type, quality, maxWidth })`, `reset()`.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `cropper-default.ts` | D-1 Default (free), D-15 Keyboard-only (arrows, `+`/`-`, `R`, size sliders) |
| `aspect` | `cropper-aspect.ts` | D-3 Variants (`aspectRatio` 1, 16/9, `shape="circle"`) |
| `controlled` | `cropper-controlled.ts` | D-9 Controlled (`value` from outside, preview of the result) |
| `toolbar` | `cropper-toolbar.ts` | D-16 Density / D-17 Composition (custom `toolbar` slot, export with `getCroppedBlob()`) |

Not yet covered: D-2 playground, D-6 states, D-7 disabled, D-8 error, D-11 RTL, D-12 dark / D-13 brand (theme switch
of the docs site), D-14 long content, D-18 customization, D-19 i18n, D-20 loading. Not applicable: D-4, D-5, D-10.

## Differences

- A custom toolbar calls `zoomTo(zoom)` / `rotateTo(degrees)` (clamped to `minZoom`..`maxZoom`, quarter turns; both
  rotate or scale the area like the built-in buttons and emit `zInput` + `zChange`). Setting `value.rotate` directly
  keeps the area coordinates (constrained to the rotated image) and emits nothing.
- After load the element writes the normalized area to `value` without an event; read it from the proxy
  (`viewChild(ZCropper).value`) when the app has not received an event yet.
- A new `value` reaches the element on the next render: call `getCroppedBlob()` after it (`afterNextRender`).
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: aspect

#### Angular
```typescript
import { Component, computed, signal } from '@angular/core';
import { ZCropper, ZSegmented, ZSegmentedItem, ZStack } from '@zelviora/angular';
import { aspectDefault, aspectLabel, aspectOption, aspectOptions, sampleAlt, sampleImage } from '../data';

/** A fixed `aspectRatio` (one size slider instead of two) and the circle `shape` of an avatar (the value stays a rectangle). */
@Component({
  selector: 'demo-cropper-aspect',
  imports: [ZCropper, ZSegmented, ZSegmentedItem, ZStack],
  template: `
    <z-stack gap="sm" class="demo-narrow">
      <z-segmented [label]="label" [value]="preset()" (zChange)="preset.set($event.detail.value)">
        @for (o of options; track o.value) {
          <z-segmented-item [value]="o.value">{{ o.label }}</z-segmented-item>
        }
      </z-segmented>
      <z-cropper [src]="src" [alt]="alt" [aspectRatio]="option().aspectRatio" [shape]="option().shape" [disableRotate]="true"></z-cropper>
    </z-stack>
  `,
})
export class CropperAspect {
  readonly src = sampleImage;
  readonly alt = sampleAlt;
  readonly label = aspectLabel;
  readonly options = aspectOptions;
  readonly preset = signal<string>(aspectDefault);
  readonly option = computed(() => aspectOption(this.preset()));
}

```

### Case: controlled

#### Angular
```typescript
import { Component, DestroyRef, inject, signal, viewChild } from '@angular/core';
import { ZButton, ZCropper, ZGrid, ZStack, ZText } from '@zelviora/angular';
import {
  controlledInitial, controlledPresets, previewAlt, previewEmpty, previewHeading, previewMaxWidth, sampleAlt, sampleImage,
  valueLog, type CropArea,
} from '../data';

/** The app holds `value` (pixels of the original image) and updates it on `zInput`; `zChange` refreshes a preview. */
@Component({
  selector: 'demo-cropper-controlled',
  imports: [ZButton, ZCropper, ZGrid, ZStack, ZText],
  template: `
    <z-grid columns="1 sm:2" gap="lg">
      <z-stack gap="sm">
        <z-stack orientation="horizontal" gap="sm" [wrap]="true">
          @for (p of presets; track p.label) {
            <z-button size="sm" variant="outline" tone="neutral" (click)="value.set(p.value)">{{ p.label }}</z-button>
          }
        </z-stack>
        <z-cropper
          [src]="src"
          [alt]="alt"
          [value]="value()"
          (zInput)="value.set($event.detail.value)"
          (zChange)="value.set($event.detail.value); refresh()"
          (zLoad)="refresh()"
        ></z-cropper>
      </z-stack>
      <z-stack gap="sm">
        <z-text variant="strong">{{ previewHeading }}</z-text>
        @if (preview(); as url) {
          <img [src]="url" [alt]="previewAlt" />
        } @else {
          <z-text variant="muted">{{ previewEmpty }}</z-text>
        }
        <z-text variant="muted" size="sm">{{ valueLog(value()) }}</z-text>
      </z-stack>
    </z-grid>
  `,
})
export class CropperControlled {
  readonly src = sampleImage;
  readonly alt = sampleAlt;
  readonly presets = controlledPresets;
  readonly previewHeading = previewHeading;
  readonly previewAlt = previewAlt;
  readonly previewEmpty = previewEmpty;
  readonly valueLog = valueLog;
  readonly value = signal<CropArea>(controlledInitial);
  readonly preview = signal<string | undefined>(undefined);
  private readonly cropper = viewChild.required(ZCropper);

  constructor() {
    inject(DestroyRef).onDestroy(() => this.revoke());
  }

  /** getCroppedBlob() draws the area on a canvas (same-origin image here). */
  async refresh() {
    const blob = await this.cropper().getCroppedBlob({ maxWidth: previewMaxWidth }).catch(() => undefined);
    if (!blob) return;
    this.revoke();
    this.preview.set(URL.createObjectURL(blob));
  }

  private revoke() {
    const url = this.preview();
    if (url) URL.revokeObjectURL(url);
  }
}

```

### Case: default

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZCropper, ZStack, ZText } from '@zelviora/angular';
import { changeLog, emptyLog, loadLog, sampleAlt, sampleImage } from '../data';

/**
 * Free crop area: drag the frame or its handles, wheel or pinch to zoom, rotate with the toolbar. The frame is focusable:
 * the arrow keys move it and the size sliders resize it.
 */
@Component({
  selector: 'demo-cropper-default',
  imports: [ZCropper, ZStack, ZText],
  template: `
    <z-stack gap="sm" class="demo-narrow">
      <z-cropper
        [src]="src"
        [alt]="alt"
        (zLoad)="log.set(loadLog($event.detail.naturalWidth, $event.detail.naturalHeight))"
        (zChange)="log.set(changeLog($event.detail.value))"
      ></z-cropper>
      <z-text variant="muted" size="sm">{{ log() }}</z-text>
    </z-stack>
  `,
})
export class CropperDefault {
  readonly src = sampleImage;
  readonly alt = sampleAlt;
  readonly loadLog = loadLog;
  readonly changeLog = changeLog;
  readonly log = signal(emptyLog);
}

```

### Case: toolbar

#### Angular
```typescript
import { Component, signal, viewChild } from '@angular/core';
import { ZButton, ZButtonGroup, ZCropper, ZStack, ZText } from '@zelviora/angular';
import {
  emptyLog, exportLog, exportType, rotateStep, sampleAlt, sampleImage, toolbarButtons, toolbarLabel, toolbarLog, zoomStep,
  type CropArea,
} from '../data';

/**
 * The `toolbar` slot replaces the default buttons: zoomTo() / rotateTo() change the view (clamped to minZoom..maxZoom,
 * quarter turns; both emit zInput and zChange), reset() returns to the default and getCroppedBlob() exports the area.
 */
@Component({
  selector: 'demo-cropper-toolbar',
  imports: [ZButton, ZButtonGroup, ZCropper, ZStack, ZText],
  template: `
    <z-stack gap="sm" class="demo-narrow">
      <z-cropper [src]="src" [alt]="alt" (zLoad)="area.set(cropper().value)" (zInput)="area.set($event.detail.value)" (zChange)="area.set($event.detail.value)">
        <z-button-group slot="toolbar" [label]="toolbarLabel">
          <z-button size="sm" variant="outline" tone="neutral" (click)="zoom(-zoomStep)">{{ buttons.zoomOut }}</z-button>
          <z-button size="sm" variant="outline" tone="neutral" (click)="zoom(zoomStep)">{{ buttons.zoomIn }}</z-button>
          <z-button size="sm" variant="outline" tone="neutral" (click)="rotate()">{{ buttons.rotate }}</z-button>
          <z-button size="sm" variant="outline" tone="neutral" (click)="reset()">{{ buttons.reset }}</z-button>
          <z-button size="sm" (click)="exportArea()">{{ buttons.export }}</z-button>
        </z-button-group>
      </z-cropper>
      <z-text variant="muted" size="sm">{{ toolbarLog(area(), exported()) }}</z-text>
    </z-stack>
  `,
})
export class CropperToolbar {
  readonly src = sampleImage;
  readonly alt = sampleAlt;
  readonly toolbarLabel = toolbarLabel;
  readonly buttons = toolbarButtons;
  readonly zoomStep = zoomStep;
  readonly toolbarLog = toolbarLog;
  readonly area = signal<CropArea | undefined>(undefined);
  readonly exported = signal(emptyLog);
  readonly cropper = viewChild.required(ZCropper);

  zoom(step: number) {
    void this.cropper().zoomTo((this.area()?.zoom ?? 1) + step);
  }

  rotate() {
    void this.cropper().rotateTo((this.area()?.rotate ?? 0) + rotateStep);
  }

  async reset() {
    await this.cropper().reset();
    this.area.set(this.cropper().value);
  }

  async exportArea() {
    const blob = await this.cropper().getCroppedBlob({ type: exportType }).catch(() => undefined);
    this.exported.set(exportLog(blob));
  }
}

```


================================================================================
# COMPONENT: CUSTOM-CHART
================================================================================

## Documentation

# Custom chart (`<z-custom-chart>`)

Extensible ECharts CustomChart supporting custom renderItem callbacks and bespoke visual encodings.

## Installation & Import

```tsx
// React (@zelviora/react-chart)
import { ZCustomChart } from '@zelviora/react-chart';

// Vue 3 (@zelviora/vue-chart)
import { ZCustomChart } from '@zelviora/vue-chart';

// Angular (@zelviora/angular-chart)
import { ZCustomChart } from '@zelviora/angular-chart';

// Web Components (@zelviora/chart)
import '@zelviora/chart';
```

## Key Features

- **Tree-shaken ECharts 6 Core**: Automatically registers only the required ECharts chart module and components.
- **Design System Token Synchronization**: Reads `--z-chart-series-1..8`, `--z-chart-grid-color`, and `--z-chart-axis-color`, reacting automatically to Light/Dark mode and theme preset changes.
- **Built-in Accessibility (WCAG AAA)**: Renders a semantic `<figure>` with `<figcaption>`, interactive `aria-pressed` legend toggles, and a synchronized `<table>` for screen readers.
- **Escape Hatch (`option`)**: Deep-merges any raw ECharts `option` object on top of the declarative props.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCustomChart } from '@zelviora/angular-chart';
import { slaData, slaSeries } from '../data';

@Component({
  selector: 'demo-custom-chart-basic',
  imports: [ZCustomChart],
  template: `
    <z-custom-chart
      heading="Quarterly SLA Target vs Actual Performance"
      description="Bespoke custom series comparing actual availability scores against target baselines."
      xKey="quarter" [data]="data" [series]="series"
    ></z-custom-chart>
  `,
})
export class CustomChartBasic {
  readonly data = slaData;
  readonly series = slaSeries;
}

```

### Case: controlled

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/angular';
import { ZCustomChart, type ChartPointSelectDetail, type ChartSeriesToggleDetail } from '@zelviora/angular-chart';
import { slaData, slaSeries } from '../data';

@Component({
  selector: 'demo-custom-chart-controlled',
  imports: [ZStack, ZButton, ZBadge, ZText, ZCustomChart],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <z-button size="sm" variant="outline" (click)="hidden = []">
          Show All Series
        </z-button>
        <z-badge tone="primary" variant="soft">{{ selected }}</z-badge>
        <z-text variant="muted" size="sm">
          Hidden: {{ hidden.length ? hidden.join(', ') : 'none' }}
        </z-text>
      </z-stack>
      <z-custom-chart
        heading="Quarterly SLA Target vs Actual Performance (Interactive)"
        description="Bespoke custom series comparing actual availability scores against target baselines."
        xKey="quarter" [data]="data" [series]="series"
        [selectable]="true"
        [hiddenSeries]="hidden"
        (zSeriesToggle)="onToggle($event)"
        (zPointSelect)="onSelect($event)"
      ></z-custom-chart>
    </z-stack>
  `,
})
export class CustomChartControlled {
  readonly data = slaData;
  readonly series = slaSeries;
  hidden: string[] = [];
  selected = 'Click any chart element to inspect';

  onToggle(e: CustomEvent<ChartSeriesToggleDetail>) {
    this.hidden = e.detail.hiddenSeries;
  }

  onSelect(e: CustomEvent<ChartPointSelectDetail>) {
    this.selected = `Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`;
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCustomChart } from '@zelviora/angular-chart';
import { slaData, slaSeries } from '../data';

@Component({
  selector: 'demo-custom-chart-customization',
  imports: [ZCustomChart],
  template: `
    <z-custom-chart
      class="demo-chart-brand"
      description="Bespoke custom series comparing actual availability scores against target baselines."
      [valueFormat]="{ maximumFractionDigits: 1 }"
      xKey="quarter" [data]="data" [series]="series" [dataZoom]="true" renderer="canvas"
    >
      <span slot="heading">Quarterly SLA Target vs Actual Performance — Custom Theme Tokens &amp; Canvas</span>
    </z-custom-chart>
  `,
})
export class CustomChartCustomization {
  readonly data = slaData;
  readonly series = slaSeries;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZCustomChart } from '@zelviora/angular-chart';
import { slaData, slaSeries } from '../data';

@Component({
  selector: 'demo-custom-chart-states',
  imports: [ZStack, ZCustomChart],
  template: `
    <z-stack gap="lg">
      <z-custom-chart
        heading="Loading State (aria-busy)"
        [loading]="true"
        xKey="quarter" [data]="data" [series]="series"
      ></z-custom-chart>
      <z-custom-chart
        heading="Empty State"
        [data]="[]"
        [series]="series"
      ></z-custom-chart>
      <z-custom-chart
        heading="Expanded Accessible Data Table"
        description="Bespoke custom series comparing actual availability scores against target baselines."
        [showDataTable]="true"
        xKey="quarter" [data]="data" [series]="series"
      ></z-custom-chart>
    </z-stack>
  `,
})
export class CustomChartStates {
  readonly data = slaData;
  readonly series = slaSeries;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZCustomChart } from '@zelviora/angular-chart';
import { slaData, slaSeries } from '../data';

@Component({
  selector: 'demo-custom-chart-variants',
  imports: [ZStack, ZCustomChart],
  template: `
    <z-stack gap="lg">
      <z-custom-chart
        heading="Zoomable Custom Series"
        description="Interactive dataZoom custom series vs point-tooltip inspection mode."
        xKey="quarter" [data]="data" [series]="series" [dataZoom]="true"
      ></z-custom-chart>
      <z-custom-chart
        heading="Point Tooltip Mode"
        description="Interactive dataZoom custom series vs point-tooltip inspection mode."
        xKey="quarter" [data]="data" [series]="series" tooltipMode="point"
      ></z-custom-chart>
    </z-stack>
  `,
})
export class CustomChartVariants {
  readonly data = slaData;
  readonly series = slaSeries;
}

```


================================================================================
# COMPONENT: DATA-TABLE
================================================================================

## Documentation

# data-table — Angular

Processed requirements of [`<z-data-table>`](../../../../../requirements/04-components/data-display/data-table.md) for Angular
(`@zelviora/angular`, standalone components, Angular 18–21).

## Usage

```html
<z-data-table label="Orders" rowHeader="code" selectionMode="multiple" [searchable]="true" [columns]="columns" [rows]="rows"
  [selectedKeys]="selected()" (zSelectionChange)="selected.set($event.detail.value)"></z-data-table>
```

Arrays, objects and functions are bound with `[prop]="…"`; boolean props with `[prop]="true"`. Slots for cells,
headers, filters and detail rows are rendered with `@for` and `[attr.slot]` (or `ZTableCellTemplate` from `@zelviora/angular`).

## Binding

No `ngModel` (spec §12). Two-way state: `[sort]` + `(zSortChange)`, `[selectedKeys]` + `(zSelectionChange)`,
`[hiddenColumns]` + `(zColumnVisibilityChange)`, `[globalFilter]` + `(zSearch)`, `[page]` + `(zPageChange)`.
Cell editing (columns with `editable`): update `rows` in `(zCellChange)`; call `$event.preventDefault()` in
`(zBeforeCellChange)` to refuse a value. `virtualColumns` renders only the body cells in view.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `data-table-basic.ts` | D-1 Default (50 orders), D-15 Keyboard-only (arrows, Home/End, PageUp/PageDown, Enter on headers) |
| `appearance` | `data-table-appearance.ts` | D-3 striped / bordered, D-5 Sizes, D-16 Density |
| `states` | `data-table-states.ts` | D-6 States (loading, empty, sorted, selected), D-20 Empty / loading |
| `selection` | `data-table-selection.ts` | D-7 Disabled rows (`disabledKey="locked"`), D-10 "select rows, then send" |
| `error` | `data-table-error.ts` | D-8 Error (alert in the `empty` slot) |
| `controlled` | `data-table-controlled.ts` | D-9 Controlled (`processing="manual"`, simulated server), D-28 manual search |
| `toolbar` | `data-table-toolbar.ts` | D-17 Composition (search, header filters, export button, column menu), D-28 client search, D-29 column visibility saved in localStorage |
| `virtual` | `data-table-virtual.ts` | D-21 Virtual 10 000 rows |
| `tree` | `data-table-tree.ts` | D-22 Tree data |
| `expandable` | `data-table-expandable.ts` | D-23 Expandable rows, D-27 Nested table |
| `pinned` | `data-table-pinned.ts` | D-24 Pinned + resize, D-14 Long content (40 columns, long headers) |
| `multi-sort` | `data-table-multi-sort.ts` | D-25 Multi-sort |
| `grouped` | `data-table-grouped.ts` | D-26 Grouped header (selection + pinned column) |
| `conditional` | `data-table-conditional.ts` | D-30 Conditional style, D-18 Customization (`::part`, class `demo-data-table-orders` of `demo.css`) |
| `rtl` | `data-table-rtl.ts` | D-11 RTL |
| `wide` | `data-table-wide.ts` | D-31 Virtual columns (201 columns × 1000 rows, pinned store column) |
| `editable` | `data-table-editable.ts` | D-32 Editable cells (text, select and number editors; validation in the before event) |
| `transactions` | `data-table-transactions.ts` | Delta updates (`applyTransaction`), function `rowKey`, `valueGetter`, `cellFlash` and `zCellClick` |
| `editing-modes` | `data-table-editing-modes.ts` | Double-click / `editOnKeyPress`, `checkbox` & `date` editors, `valueSetter`, `editMode` (`cell` / `row` / `popup`), `undo()` / `redo()` |
| `clipboard-export` | `data-table-clipboard-export.ts` | `contextMenu`, TSV clipboard copy/paste (`zCopy` / `zPaste`), `statusBar` aggregations and `exportCsv()` |
| `column-management` | `data-table-column-management.ts` | `reorderableColumns`, `columnMenu`, `set` & `boolean` filters, and `getState()` / `setState()` |
| `pinned-rows-spanning` | `data-table-pinned-rows-spanning.ts` | `pinnedTopRows` / `pinnedBottomRows`, `wrapText`, `cellSpan`, `cellPartRules` and built-in `error` / `errorText` |
| `grouping-dragging` | `data-table-grouping-dragging.ts` | Client-side `groupBy` + `aggFunc` (`count`, `sum`) and `rowDraggable` reorder (`zRowOrderChange`) |
| `lazy-datasource` | `data-table-lazy-datasource.ts` | Virtualized `ZTableCellTemplate`, LRU block `datasource` and lazy `rowExpandable` + `renderDetail` |
| `i18n` | `data-table-i18n.ts` | D-19 i18n |
| `pivot-basic` | `data-table-pivot-basic.ts` | D-37 Pivot: regions by year (`pivotMode`, `pivot` rows/columns/values, `totalColumn`, `totalRow`) |
| `pivot-groups` | `data-table-pivot-groups.ts` | D-38 Pivot: row group tree with subtotals, split values, custom `aggFunc`, `totalColumn`, `groupDefaultExpanded`, `sortColumns` |
| `pivot-workbench` | `data-table-pivot-workbench.ts` | D-39 Pivot workbench: `pivotSidebar`, `rowGroupPanel`, `pivotPanel`, `setPivotConfig()` / `getPivotConfig()`, `zPivotChange`, `zRowGroupChange` |
| `formula-columns` | `data-table-formula-columns.ts` | D-40 Formula: same-row and horizontal column `formula`, `formulaErrors`, `getComputedRows()` |
| `formula-quarterly` | `data-table-formula-quarterly.ts` | D-41 Formula: SUM/MAX, `{{rows.total}}` vs `{{visible.total}}` |
| `formula-tree` | `data-table-formula-tree.ts` | D-42 Formula: tree budget, `formulaScope: parent`, `SUM({{children.x}})` |
| `formula-workbench` | `data-table-formula-workbench.ts` | D-43 Formula workbench: `formulaEditor`, `formulaErrors`, `getFormulas()`, `zColumnFormulaChange` |
| `pivot-formula` | `data-table-pivot-formula.ts` | D-44 Pivot x formula: pivot over formula columns with sidebar, row group bar and `formulaEditor` |
| `editors` | `data-table-editors.ts` | D-45 Cell editors: text, email, textarea, number, slider, rating, select, radio, combobox, multiselect, tags, date, time, color, checkbox, switch |

Not yet covered: D-2 playground, D-12 dark and D-13 brand showcase (theme switch of the docs site), D-4 tones (not applicable).


## Examples & Implementation

### Case: appearance

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZConfigProvider, ZDataTable, ZStack } from '@zelviora/angular';
import { basicColumns, makeOrders } from '../data';

@Component({
  selector: 'demo-data-table-appearance',
  imports: [ZConfigProvider, ZDataTable, ZStack],
  template: `
    <z-stack gap="lg">
      <z-data-table label="Small, striped" size="sm" [striped]="true" rowHeader="code" [columns]="columns" [rows]="rows"></z-data-table>
      <z-data-table label="Medium, bordered" [bordered]="true" rowHeader="code" [columns]="columns" [rows]="rows"></z-data-table>
      <z-data-table label="Large, striped and bordered" size="lg" [striped]="true" [bordered]="true" rowHeader="code" [columns]="columns" [rows]="rows"></z-data-table>
      <z-config-provider density="compact">
        <z-data-table label="Compact density" rowHeader="code" [columns]="columns" [rows]="rows"></z-data-table>
      </z-config-provider>
    </z-stack>
  `,
})
export class DataTableAppearance {
  readonly columns = basicColumns;
  readonly rows = makeOrders(4);
}

```

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDataTable } from '@zelviora/angular';
import { basicColumns, makeOrders } from '../data';

/** Click a header or press Enter on it to sort; arrows, Home/End and PageUp/PageDown move the focused cell. */
@Component({
  selector: 'demo-data-table-basic',
  imports: [ZDataTable],
  template: `<z-data-table label="Orders" rowHeader="code" [columns]="columns" [rows]="rows" [pageSize]="10"></z-data-table>`,
})
export class DataTableBasic {
  readonly columns = basicColumns;
  readonly rows = makeOrders(50);
}

```

### Case: clipboard-export

#### Angular
```typescript
import { Component, ElementRef, signal, viewChild } from '@angular/core';
import { ZButton, ZDataTable, ZStack } from '@zelviora/angular';
import { editableColumns, makeOrders, type Order } from '../data';

type TableEl = HTMLElement & { exportCsv(opts?: { fileName?: string; onlySelected?: boolean }): Promise<void> };

/**
 * Right-click (or press Shift+F10) on a cell for the context menu, press Ctrl/Cmd+C and Ctrl/Cmd+V to copy and paste TSV
 * ranges, select rows to inspect live numeric aggregations in the status bar, or export CSV with UTF-8 BOM.
 */
@Component({
  selector: 'demo-data-table-clipboard-export',
  imports: [ZButton, ZDataTable, ZStack],
  template: `
    <z-stack gap="sm">
      <z-data-table
        #table
        label="Orders with clipboard and CSV export"
        rowHeader="code"
        selectionMode="multiple"
        [statusBar]="true"
        [contextMenu]="true"
        [searchable]="true"
        [pageSize]="0"
        [columns]="columns"
        [rows]="rows()"
        [selectedKeys]="selected()"
        (zSelectionChange)="selected.set($event.detail.value)"
        (zCopy)="onCopy($event)"
        (zPaste)="onPaste($event)"
        (zCellChange)="onCellChange($event)"
      >
        <z-button slot="toolbar" size="sm" variant="outline" tone="neutral" (click)="exportAll()">Export all CSV</z-button>
        <z-button slot="toolbar" size="sm" variant="outline" tone="neutral" [disabled]="!selected().length" (click)="exportSelected()">
          Export selected ({{ selected().length }})
        </z-button>
      </z-data-table>
      <p role="status">{{ status() }}</p>
    </z-stack>
  `,
})
export class DataTableClipboardExport {
  private readonly table = viewChild.required('table', { read: ElementRef });
  readonly columns = editableColumns;
  readonly rows = signal<Order[]>(makeOrders(10));
  readonly selected = signal<string[]>(['o1', 'o2']);
  readonly status = signal('Select rows to view sum/avg metrics in the status bar, or right-click a cell.');

  exportAll() {
    void (this.table().nativeElement as TableEl).exportCsv({ fileName: 'orders.csv' });
  }

  exportSelected() {
    void (this.table().nativeElement as TableEl).exportCsv({ fileName: 'selected-orders.csv', onlySelected: true });
  }

  onCopy(e: CustomEvent<{ rowKeys: string[] }>) {
    this.status.set(`Copied ${e.detail.rowKeys.length} row(s) to clipboard.`);
  }

  onPaste(e: CustomEvent<{ rowKey: string; column: string }>) {
    this.status.set(`Pasted clipboard data starting at ${e.detail.rowKey} (${e.detail.column}).`);
  }

  onCellChange(e: CustomEvent<{ rowKey: string; column: string; value: unknown }>) {
    const { rowKey, column, value } = e.detail;
    this.rows.update((list) => list.map((r) => (r.key === rowKey ? { ...r, [column]: value } : r)));
  }
}

```

### Case: column-management

#### Angular
```typescript
import { Component, ElementRef, signal, viewChild } from '@angular/core';
import { ZButton, ZDataTable, ZStack } from '@zelviora/angular';
import { makeOrders, managedColumns } from '../data';

type TableEl = HTMLElement & {
  getState(): Promise<Record<string, unknown>>;
  setState(state: Record<string, unknown>): Promise<void>;
};

/**
 * Drag column headers (or press Alt+ArrowLeft / Alt+ArrowRight) to reorder columns, open the header menu (`columnMenu`)
 * to pin, autosize or hide columns, filter with `set` and `boolean` popovers, and snapshot/restore state via `getState()` / `setState()`.
 */
@Component({
  selector: 'demo-data-table-column-management',
  imports: [ZButton, ZDataTable, ZStack],
  template: `
    <z-stack gap="sm">
      <z-stack orientation="horizontal" gap="sm" alignItems="center">
        <z-button size="sm" variant="outline" tone="neutral" (click)="saveLayout()">Save state</z-button>
        <z-button size="sm" variant="outline" tone="neutral" [disabled]="!savedState()" (click)="restoreLayout()">Restore state</z-button>
        <z-button size="sm" variant="outline" tone="neutral" (click)="resetLayout()">Reset</z-button>
      </z-stack>
      <z-data-table
        #table
        label="Managed order columns"
        rowHeader="code"
        [reorderableColumns]="true"
        [columnMenu]="true"
        [columnToggle]="true"
        [searchable]="true"
        [pageSize]="8"
        [columns]="columns"
        [rows]="rows"
        (zColumnOrderChange)="onOrderChange($event)"
        (zColumnPinChange)="onPinChange($event)"
      ></z-data-table>
      <p role="status">{{ message() }}</p>
    </z-stack>
  `,
})
export class DataTableColumnManagement {
  private readonly table = viewChild.required('table', { read: ElementRef });
  readonly columns = managedColumns;
  readonly rows = makeOrders(24);
  readonly savedState = signal<Record<string, unknown> | null>(null);
  readonly message = signal('Drag a column header, open its menu, or filter by City / Status / Paid.');

  async saveLayout() {
    const state = await (this.table().nativeElement as TableEl).getState();
    this.savedState.set(state);
    this.message.set('Saved column order, pins, widths, sort and filters.');
  }

  async restoreLayout() {
    const state = this.savedState();
    if (!state) return;
    await (this.table().nativeElement as TableEl).setState(state);
    this.message.set('Restored saved table state.');
  }

  async resetLayout() {
    await (this.table().nativeElement as TableEl).setState({
      sort: [],
      filters: {},
      globalFilter: '',
      hiddenColumns: [],
      columnWidths: {},
      columnOrder: [],
      pinnedColumns: {},
      page: 1,
    });
    this.message.set('Reset layout to defaults.');
  }

  onOrderChange(e: CustomEvent<{ columnOrder: string[] }>) {
    this.message.set(`Column order: ${e.detail.columnOrder.join(' → ')}`);
  }

  onPinChange(e: CustomEvent<{ column: string; pinned: string | null }>) {
    this.message.set(`Column ${e.detail.column} pin: ${e.detail.pinned ?? 'unpinned'}`);
  }
}

```

### Case: conditional

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDataTable } from '@zelviora/angular';
import { basicColumns, makeOrders, type Order } from '../data';

@Component({
  selector: 'demo-data-table-conditional',
  imports: [ZDataTable],
  template: `<z-data-table class="demo-data-table-orders" label="Orders" rowHeader="code" [columns]="columns" [rows]="rows" [rowParts]="rowParts" [cellParts]="cellParts"></z-data-table>`,
})
export class DataTableConditional {
  readonly columns = basicColumns;
  readonly rows = makeOrders(12);
  readonly rowParts = (r: Order) => (r.status === 'Overdue' ? ['overdue'] : []);
  readonly cellParts = (r: Order, key: string) => (key === 'total' && r.total < 0 ? ['negative'] : []);
}

```

### Case: controlled

#### Angular
```typescript
import { Component, effect, signal } from '@angular/core';
import { ZDataTable } from '@zelviora/angular';
import { basicColumns, makeOrders, type Order } from '../data';

const all = makeOrders(120);
type Sort = Array<{ key: string; direction: 'ascending' | 'descending' }>;

/** Pretends to be a server: filters, sorts and returns one page after a short delay. */
function query(sort: Sort, search: string, page: number, size: number): Promise<{ rows: Order[]; total: number }> {
  const q = search.trim().toLowerCase();
  let list = q ? all.filter((o) => `${o.code} ${o.customer} ${o.city}`.toLowerCase().includes(q)) : all;
  const s = sort[0];
  if (s) list = [...list].sort((a, b) => (s.direction === 'ascending' ? 1 : -1) * String(a[s.key as keyof Order]).localeCompare(String(b[s.key as keyof Order]), undefined, { numeric: true }));
  return new Promise((resolve) => setTimeout(() => resolve({ rows: list.slice((page - 1) * size, page * size), total: list.length }), 300));
}

@Component({
  selector: 'demo-data-table-controlled',
  imports: [ZDataTable],
  template: `
    <z-data-table label="Orders (server)" rowHeader="code" processing="manual" [searchable]="true" [pageSize]="10" [pageSizeOptions]="[10]"
      [columns]="columns" [rows]="data().rows" [rowCount]="data().total" [loading]="loading()" [sort]="sort()" [page]="page()" [globalFilter]="search()"
      (zSortChange)="sort.set($event.detail.sort)" (zSearch)="search.set($event.detail.query)" (zPageChange)="page.set($event.detail.page)"></z-data-table>
  `,
})
export class DataTableControlled {
  readonly columns = basicColumns;
  readonly sort = signal<Sort>([]);
  readonly search = signal('');
  readonly page = signal(1);
  readonly data = signal<{ rows: Order[]; total: number }>({ rows: [], total: 0 });
  readonly loading = signal(true);
  constructor() {
    effect((onCleanup) => {
      let live = true;
      onCleanup(() => { live = false; });
      this.loading.set(true);
      void query(this.sort(), this.search(), this.page(), 10).then((d) => { if (live) { this.data.set(d); this.loading.set(false); } });
    });
  }
}

```

### Case: editable

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZDataTable, ZStack } from '@zelviora/angular';
import { editableColumns, editError, makeOrders } from '../data';

type Change = { rowKey: string; column: string; value: unknown };

/**
 * Enter or F2 edits a cell, Enter or Tab commits, Escape cancels. The table never changes `rows`: the app refuses invalid
 * values in the before cell change event and applies the others in the cell change event.
 */
@Component({
  selector: 'demo-data-table-editable',
  imports: [ZDataTable, ZStack],
  template: `
    <z-stack gap="sm">
      <z-data-table label="Editable orders" rowHeader="code" [pageSize]="0" [columns]="columns" [rows]="rows()"
        (zBeforeCellChange)="check($event)" (zCellChange)="apply($event)"></z-data-table>
      <p role="status">{{ message() }}</p>
    </z-stack>
  `,
})
export class DataTableEditable {
  readonly columns = editableColumns;
  readonly rows = signal(makeOrders(8));
  readonly message = signal('Edit the customer, the status or the total.');

  check(e: CustomEvent<Change>) {
    const error = editError(e.detail.column, e.detail.value);
    if (error) {
      e.preventDefault();
      this.message.set(error);
    }
  }

  apply(e: CustomEvent<Change>) {
    const { rowKey, column, value } = e.detail;
    this.rows.update((list) => list.map((r) => (r.key === rowKey ? { ...r, [column]: value } : r)));
    this.message.set(`Saved ${column} of ${rowKey}.`);
  }
}

```

### Case: editing-modes

#### Angular
```typescript
import { Component, ElementRef, signal, viewChild } from '@angular/core';
import { ZButton, ZDataTable, ZStack } from '@zelviora/angular';
import { advancedEditColumns, editError, makeOrders, type Order } from '../data';

type EditMode = 'cell' | 'row' | 'popup';
type TableEl = HTMLElement & { undo(): Promise<boolean>; redo(): Promise<boolean> };
type ChangeDetail = { rowKey: string; column: string; value: unknown; updatedRow?: Order; changes?: Record<string, unknown> };

/**
 * Double-click, Enter, F2 or typing (`editOnKeyPress`) starts editing with text (`valueSetter`), select, checkbox, date
 * and number editors. Switch between inline `cell`, full-`row` and `popup` modes, or undo/redo (`Ctrl+Z` / `Ctrl+Y`).
 */
@Component({
  selector: 'demo-data-table-editing-modes',
  imports: [ZButton, ZDataTable, ZStack],
  template: `
    <z-stack gap="sm">
      <z-stack orientation="horizontal" gap="sm" alignItems="center">
        <z-button size="sm" [variant]="mode() === 'cell' ? 'solid' : 'outline'" tone="neutral" (click)="mode.set('cell')">Cell mode</z-button>
        <z-button size="sm" [variant]="mode() === 'row' ? 'solid' : 'outline'" tone="neutral" (click)="mode.set('row')">Full-row mode</z-button>
        <z-button size="sm" [variant]="mode() === 'popup' ? 'solid' : 'outline'" tone="neutral" (click)="mode.set('popup')">Popup mode</z-button>
        <z-button size="sm" variant="outline" tone="neutral" (click)="undo()">Undo</z-button>
        <z-button size="sm" variant="outline" tone="neutral" (click)="redo()">Redo</z-button>
      </z-stack>
      <z-data-table
        #table
        label="Advanced editable orders"
        rowHeader="code"
        [editMode]="mode()"
        [editOnKeyPress]="true"
        [cellFlash]="true"
        [pageSize]="0"
        [columns]="columns"
        [rows]="rows()"
        (zBeforeCellChange)="check($event)"
        (zCellChange)="apply($event)"
      ></z-data-table>
      <p role="status">{{ message() }}</p>
    </z-stack>
  `,
})
export class DataTableEditingModes {
  private readonly table = viewChild.required('table', { read: ElementRef });
  readonly columns = advancedEditColumns;
  readonly rows = signal<Order[]>(makeOrders(6));
  readonly mode = signal<EditMode>('cell');
  readonly message = signal('Double-click or type on a cell to edit; press Delete to clear.');

  undo() {
    void (this.table().nativeElement as TableEl).undo();
  }

  redo() {
    void (this.table().nativeElement as TableEl).redo();
  }

  check(e: CustomEvent<ChangeDetail>) {
    const err = editError(e.detail.column, e.detail.value);
    if (err) {
      e.preventDefault();
      this.message.set(err);
    }
  }

  apply(e: CustomEvent<ChangeDetail>) {
    const { rowKey, column, value, updatedRow, changes } = e.detail;
    this.rows.update((list) => list.map((r) => (r.key === rowKey ? (updatedRow ?? { ...r, [column]: value }) : r)));
    this.message.set(`Committed ${changes ? 'row changes' : column} on ${rowKey}.`);
  }
}

```

### Case: editors

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZDataTable, ZStack } from '@zelviora/angular';
import { editorColumns, makeEditorRows, type EditorRow } from '../data-analytics';

/**
 * One editor per column: text, email, textarea, number, slider, rating, select, radio, combobox, multiselect, tags, date, time,
 * color, checkbox and switch. Open a cell with Enter, F2 or a double click; Enter commits and Escape cancels.
 */
@Component({
  selector: 'demo-data-table-editors',
  imports: [ZDataTable, ZStack],
  template: `
    <z-stack gap="sm">
      <z-data-table label="Cell editors" rowHeader="name" [pageSize]="0" [columns]="columns" [rows]="rows()" (zCellChange)="apply($event)"></z-data-table>
      <p role="status">{{ message() }}</p>
    </z-stack>
  `,
})
export class DataTableEditors {
  readonly columns = editorColumns;
  readonly rows = signal<EditorRow[]>(makeEditorRows());
  readonly message = signal('Double-click a cell to edit it with its own editor.');

  apply(e: CustomEvent<{ rowKey: string; column: string; value: unknown }>) {
    const { rowKey, column, value } = e.detail;
    this.rows.update((list) => list.map((r) => (r.key === rowKey ? { ...r, [column]: value } : r)));
    this.message.set(`Saved ${column} of ${rowKey}: ${JSON.stringify(value)}`);
  }
}

```

### Case: error

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZAlert, ZButton, ZDataTable } from '@zelviora/angular';
import { basicColumns, makeOrders } from '../data';

@Component({
  selector: 'demo-data-table-error',
  imports: [ZAlert, ZButton, ZDataTable],
  template: `
    <z-data-table label="Orders" rowHeader="code" [columns]="columns" [rows]="rows()">
      <z-alert slot="empty" tone="destructive" heading="Could not load the orders">
        The server did not answer. <z-button size="sm" variant="outline" tone="neutral" (click)="rows.set(retry())">Retry</z-button>
      </z-alert>
    </z-data-table>
  `,
})
export class DataTableError {
  readonly columns = basicColumns;
  readonly rows = signal<ReturnType<typeof makeOrders>>([]);
  retry() { return makeOrders(5); }
}

```

### Case: expandable

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDataTable, ZTable } from '@zelviora/angular';
import { basicColumns, makeOrders } from '../data';

@Component({
  selector: 'demo-data-table-expandable',
  imports: [ZDataTable, ZTable],
  template: `
    <z-data-table label="Orders with lines" rowHeader="code" [columns]="columns" [rows]="rows" [expandedKeys]="expanded">
      @for (o of rows; track o.key) {
        <z-table [attr.slot]="'expanded:' + o.key" [caption]="'Lines of ' + o.code" size="sm" [columns]="lineColumns" [rows]="o.lines"></z-table>
      }
    </z-data-table>
  `,
})
export class DataTableExpandable {
  readonly columns = basicColumns;
  readonly rows = makeOrders(6);
  readonly expanded = ['o1'];
  readonly lineColumns = [
    { key: 'sku', header: 'SKU' },
    { key: 'product', header: 'Product' },
    { key: 'qty', header: 'Qty', type: 'number' as const },
    { key: 'price', header: 'Price', format: { type: 'currency' as const, currency: 'USD' } },
  ];
}

```

### Case: formula-columns

#### Angular
```typescript
import { Component, ElementRef, signal, viewChild } from '@angular/core';
import { ZButton, ZDataTable, ZStack } from '@zelviora/angular';
import { invoiceColumns, makeInvoiceLines, type InvoiceLine } from '../data-analytics';

type TableEl = HTMLElement & { getComputedRows(): Promise<Array<Record<string, unknown>>> };

/**
 * Column `formula` with `{{column}}` of the same row: amount, net, tax, total and net per unit are read-only computed cells; qty,
 * price and discount are typed. The line with qty 0 divides by zero: `formulaErrors` shows `#DIV/0!` or 0.
 */
@Component({
  selector: 'demo-data-table-formula-columns',
  imports: [ZButton, ZDataTable, ZStack],
  template: `
    <z-stack gap="sm">
      <z-stack orientation="horizontal" gap="sm" alignItems="center">
        <z-button size="sm" [variant]="zeroErrors() ? 'solid' : 'outline'" tone="neutral" (click)="zeroErrors.set(!zeroErrors())">
          Errors as zero: {{ zeroErrors() ? 'on' : 'off' }}
        </z-button>
        <z-button size="sm" variant="outline" tone="neutral" (click)="readComputed()">getComputedRows()</z-button>
      </z-stack>
      <z-data-table
        #table
        label="Invoice lines"
        rowHeader="item"
        [pageSize]="0"
        [formulaErrors]="zeroErrors() ? 'zero' : 'error'"
        [columns]="columns"
        [rows]="rows()"
        (zCellChange)="apply($event)"
      ></z-data-table>
      <p role="status">{{ message() }}</p>
    </z-stack>
  `,
})
export class DataTableFormulaColumns {
  private readonly table = viewChild.required('table', { read: ElementRef });
  readonly columns = invoiceColumns;
  readonly rows = signal<InvoiceLine[]>(makeInvoiceLines());
  readonly zeroErrors = signal(false);
  readonly message = signal('Edit Qty, Price or Discount: Amount, Net, Tax, Total and Net per unit follow.');

  apply(e: CustomEvent<{ rowKey: string; column: string; value: unknown }>) {
    const { rowKey, column, value } = e.detail;
    this.rows.update((list) => list.map((r) => (r.key === rowKey ? { ...r, [column]: value } : r)));
    this.message.set(`Saved ${column} of ${rowKey}.`);
  }

  async readComputed() {
    const computed = await (this.table().nativeElement as TableEl).getComputedRows();
    const total = computed.reduce((sum, r) => sum + (Number(r['total']) || 0), 0);
    this.message.set(`getComputedRows(): ${computed.length} rows, sum of Total = ${total.toFixed(2)}.`);
  }
}

```

### Case: formula-quarterly

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZDataTable, ZStack } from '@zelviora/angular';
import { makeQuarterly, quarterlyColumns, type Quarterly } from '../data-analytics';

/**
 * Horizontal sums (`{{q1}} + ... + {{q4}}`), `MAX(...)`, and two whole-table shares: `{{rows.total}}` ignores the search while
 * `{{visible.total}}` follows it. Type in the search box and compare "% of all" with "% of shown".
 */
@Component({
  selector: 'demo-data-table-formula-quarterly',
  imports: [ZDataTable, ZStack],
  template: `
    <z-stack gap="sm">
      <z-data-table
        label="Quarterly sales"
        rowHeader="product"
        [pageSize]="0"
        [searchable]="true"
        [columns]="columns"
        [rows]="rows()"
        (zCellChange)="apply($event)"
      ></z-data-table>
      <p role="status">{{ message() }}</p>
    </z-stack>
  `,
})
export class DataTableFormulaQuarterly {
  readonly columns = quarterlyColumns;
  readonly rows = signal<Quarterly[]>(makeQuarterly());
  readonly message = signal('Search for a product: % of all stays, % of shown is recomputed over the visible rows.');

  apply(e: CustomEvent<{ rowKey: string; column: string; value: unknown }>) {
    const { rowKey, column, value } = e.detail;
    this.rows.update((list) => list.map((r) => (r.key === rowKey ? { ...r, [column]: value } : r)));
    this.message.set(`Saved ${column} of ${rowKey}.`);
  }
}

```

### Case: formula-tree

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZDataTable, ZStack } from '@zelviora/angular';
import { budgetColumns, makeBudget, type BudgetRow } from '../data-analytics';

function collectKeys(list: BudgetRow[], out: string[] = []): string[] {
  for (const r of list) {
    if (r.children?.length) {
      out.push(r.key);
      collectKeys(r.children, out);
    }
  }
  return out;
}

/** Immutable update of one cell anywhere in the tree (returns copies along the path). */
function setValue(list: BudgetRow[], key: string, column: string, value: unknown): BudgetRow[] {
  return list.map((r) => {
    if (r.key === key) return { ...r, [column]: value };
    if (r.children) return { ...r, children: setValue(r.children, key, column, value) };
    return r;
  });
}

/**
 * Tree data with `formulaScope: 'parent'`: a parent shows `SUM({{children.x}})`, a leaf is typed ("Enter a number"), and
 * Variance / Used % use the cells of the same row. Every level is expanded; edit a leaf and all ancestors recompute.
 */
@Component({
  selector: 'demo-data-table-formula-tree',
  imports: [ZButton, ZDataTable, ZStack],
  template: `
    <z-stack gap="sm">
      <z-stack orientation="horizontal" gap="sm" alignItems="center">
        <z-button size="sm" variant="outline" tone="neutral" (click)="reset()">Reset budget</z-button>
      </z-stack>
      <z-data-table
        label="Budget 2026"
        rowHeader="item"
        maxHeight="460px"
        childrenKey="children"
        [pageSize]="0"
        [expandedKeys]="expanded"
        [columns]="columns"
        [rows]="rows()"
        (zCellChange)="apply($event)"
      ></z-data-table>
      <p role="status">{{ message() }}</p>
    </z-stack>
  `,
})
export class DataTableFormulaTree {
  readonly columns = budgetColumns;
  readonly rows = signal<BudgetRow[]>(makeBudget());
  readonly expanded = collectKeys(makeBudget());
  readonly message = signal('Edit a leaf (Enter or F2): the parents and the root total update.');

  apply(e: CustomEvent<{ rowKey: string; column: string; value: unknown }>) {
    const { rowKey, column, value } = e.detail;
    this.rows.update((list) => setValue(list, rowKey, column, value));
    this.message.set(`Saved ${column} of ${rowKey}.`);
  }

  reset() {
    this.rows.set(makeBudget());
    this.message.set('Budget reset.');
  }
}

```

### Case: formula-workbench

#### Angular
```typescript
import { Component, ElementRef, computed, signal, viewChild } from '@angular/core';
import { ZButton, ZDataTable, ZStack } from '@zelviora/angular';
import {
  budgetColumns, invoiceColumns, makeBudget, makeInvoiceLines, makeQuarterly, quarterlyColumns,
} from '../data-analytics';

type Row = Record<string, unknown> & { key: string; children?: Row[] };
type Dataset = 'invoice' | 'quarterly' | 'budget';
type TableEl = HTMLElement & {
  getFormulas(): Promise<Record<string, unknown>>;
  getComputedRows(): Promise<Array<Record<string, unknown>>>;
};

const sources: Record<Dataset, { label: string; header: string; columns: unknown[]; make: () => Row[] }> = {
  invoice: { label: 'Invoice', header: 'item', columns: invoiceColumns, make: () => makeInvoiceLines() as unknown as Row[] },
  quarterly: { label: 'Quarterly', header: 'product', columns: quarterlyColumns, make: () => makeQuarterly() as unknown as Row[] },
  budget: { label: 'Budget tree', header: 'item', columns: budgetColumns, make: () => makeBudget() as unknown as Row[] },
};

function collectKeys(list: Row[], out: string[] = []): string[] {
  for (const r of list) {
    if (r.children?.length) {
      out.push(r.key);
      collectKeys(r.children, out);
    }
  }
  return out;
}

function setValue(list: Row[], key: string, column: string, value: unknown): Row[] {
  return list.map((r) => {
    if (r.key === key) return { ...r, [column]: value };
    if (r.children) return { ...r, children: setValue(r.children, key, column, value) };
    return r;
  });
}

/**
 * All formula features on one table: pick a dataset (invoice, quarterly, budget tree), edit formulas in the column menu
 * (`formulaEditor`), toggle `formulaErrors`, read `getFormulas()` and `getComputedRows()`, and watch `zColumnFormulaChange`.
 */
@Component({
  selector: 'demo-data-table-formula-workbench',
  imports: [ZButton, ZDataTable, ZStack],
  template: `
    <z-stack gap="sm">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" [wrap]="true">
        @for (d of datasets; track d) {
          <z-button size="sm" [variant]="dataset() === d ? 'solid' : 'outline'" tone="neutral" (click)="choose(d)">{{ sources[d].label }}</z-button>
        }
        <z-button size="sm" [variant]="zeroErrors() ? 'solid' : 'outline'" tone="neutral" (click)="zeroErrors.set(!zeroErrors())">
          Errors as zero: {{ zeroErrors() ? 'on' : 'off' }}
        </z-button>
        <z-button size="sm" variant="outline" tone="neutral" (click)="showFormulas()">getFormulas()</z-button>
        <z-button size="sm" variant="outline" tone="neutral" (click)="showComputed()">getComputedRows()</z-button>
      </z-stack>
      @for (d of [dataset()]; track d) {
        <z-data-table
          #table
          label="Formula workbench"
          [rowHeader]="source().header"
          maxHeight="460px"
          childrenKey="children"
          [pageSize]="0"
          [formulaEditor]="true"
          [formulaErrors]="zeroErrors() ? 'zero' : 'error'"
          [expandedKeys]="expanded()"
          [columns]="source().columns"
          [rows]="rows()"
          (zCellChange)="apply($event)"
          (zColumnFormulaChange)="onFormulaChange($event)"
        ></z-data-table>
      }
      <p role="status">{{ message() }}</p>
      <pre aria-label="Formulas set at runtime">{{ formulas() }}</pre>
      <ul aria-label="Event log">
        @for (line of log(); track $index) {
          <li>{{ line }}</li>
        }
      </ul>
    </z-stack>
  `,
})
export class DataTableFormulaWorkbench {
  private readonly table = viewChild<ElementRef>('table');
  readonly sources = sources;
  readonly datasets: Dataset[] = ['invoice', 'quarterly', 'budget'];
  readonly dataset = signal<Dataset>('invoice');
  readonly rows = signal<Row[]>(sources.invoice.make());
  readonly zeroErrors = signal(false);
  readonly source = computed(() => sources[this.dataset()]);
  readonly expanded = computed(() => collectKeys(this.rows()));
  readonly message = signal('Open a header menu and choose "Edit formula..." to change a formula; the table recomputes.');
  readonly formulas = signal('(press getFormulas())');
  readonly log = signal<string[]>([]);

  choose(d: Dataset) {
    this.dataset.set(d);
    this.rows.set(sources[d].make());
    this.formulas.set('(press getFormulas())');
    this.log.set([]);
    this.message.set(`Dataset: ${sources[d].label}.`);
  }

  apply(e: CustomEvent<{ rowKey: string; column: string; value: unknown }>) {
    const { rowKey, column, value } = e.detail;
    this.rows.update((list) => setValue(list, rowKey, column, value));
    this.message.set(`Saved ${column} of ${rowKey}.`);
  }

  onFormulaChange(e: CustomEvent<{ column: string; formula: string | null; formulaScope?: string }>) {
    this.log.update((l) => [`zColumnFormulaChange ${JSON.stringify(e.detail)}`, ...l].slice(0, 6));
  }

  async showFormulas() {
    const el = this.table()?.nativeElement as TableEl | undefined;
    if (el) this.formulas.set(JSON.stringify(await el.getFormulas(), null, 2));
  }

  async showComputed() {
    const el = this.table()?.nativeElement as TableEl | undefined;
    if (el) this.message.set(`getComputedRows(): ${(await el.getComputedRows()).length} rows.`);
  }
}

```

### Case: grouped

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDataTable } from '@zelviora/angular';
import { groupedColumns, makeOrders } from '../data';

@Component({
  selector: 'demo-data-table-grouped',
  imports: [ZDataTable],
  template: `<z-data-table label="Orders" rowHeader="code" selectionMode="multiple" [columns]="columns" [rows]="rows"></z-data-table>`,
})
export class DataTableGrouped {
  readonly columns = groupedColumns;
  readonly rows = makeOrders(8);
}

```

### Case: grouping-dragging

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZDataTable, ZStack } from '@zelviora/angular';
import { basicColumns, groupedRowColumns, makeOrders, type Order } from '../data';

/**
 * Client-side `groupBy` with column `aggFunc` (`count`, `sum`) builds expandable summary rows; `rowDraggable` lets users
 * reorder queue rows with the drag handle or `Alt+ArrowUp` / `Alt+ArrowDown`.
 */
@Component({
  selector: 'demo-data-table-grouping-dragging',
  imports: [ZButton, ZDataTable, ZStack],
  template: `
    <z-stack gap="lg">
      <z-stack gap="sm">
        <z-stack orientation="horizontal" gap="sm" alignItems="center">
          <z-button size="sm" [variant]="groupKeys().length === 1 ? 'solid' : 'outline'" tone="neutral" (click)="groupKeys.set(['city'])">
            Group by City
          </z-button>
          <z-button size="sm" [variant]="groupKeys().length === 2 ? 'solid' : 'outline'" tone="neutral" (click)="groupKeys.set(['city', 'status'])">
            Group by City &amp; Status
          </z-button>
          <z-button size="sm" [variant]="groupKeys().length === 0 ? 'solid' : 'outline'" tone="neutral" (click)="groupKeys.set([])">
            Ungrouped
          </z-button>
        </z-stack>
        <z-data-table
          label="Regional order aggregations"
          rowHeader="code"
          [pageSize]="0"
          maxHeight="300px"
          [groupBy]="groupKeys()"
          [expandedKeys]="expanded()"
          (zExpandedChange)="onExpandedChange($event)"
          [columns]="groupColumns"
          [rows]="groupedDataset"
        ></z-data-table>
      </z-stack>
      <z-stack gap="sm">
        <z-data-table
          label="Dispatch priority queue"
          rowHeader="code"
          [rowDraggable]="true"
          [pageSize]="0"
          [columns]="queueColumns"
          [rows]="queue()"
          (zRowOrderChange)="onRowReorder($event)"
        ></z-data-table>
        <p role="status">{{ dragMessage() }}</p>
      </z-stack>
    </z-stack>
  `,
})
export class DataTableGroupingDragging {
  readonly groupColumns = groupedRowColumns;
  readonly groupedDataset = makeOrders(18);
  readonly groupKeys = signal<string[]>(['city']);
  readonly expanded = signal<string[]>(['group:city=London']);
  readonly queueColumns = basicColumns;
  readonly queue = signal<Order[]>(makeOrders(5));
  readonly dragMessage = signal('Drag a row handle or press Alt+ArrowUp / Alt+ArrowDown to reorder.');

  onExpandedChange(e: CustomEvent<{ expandedKeys?: string[] }>) {
    this.expanded.set(e.detail.expandedKeys ?? []);
  }

  onRowReorder(e: CustomEvent<{ sourceKey: string; targetKey: string; position: string; rows: unknown[] }>) {
    this.queue.set(e.detail.rows as Order[]);
    this.dragMessage.set(`Moved ${e.detail.sourceKey} ${e.detail.position} ${e.detail.targetKey}.`);
  }
}

```

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZConfigProvider, ZDataTable } from '@zelviora/angular';
import { columns, rows } from '../data-i18n';

/** With locale `vi` the search ignores accents ("ha noi" finds "Hà Nội") and the built-in texts are Vietnamese. */
@Component({
  selector: 'demo-data-table-i18n',
  imports: [ZConfigProvider, ZDataTable],
  template: `
    <z-config-provider locale="vi">
      <z-data-table label="Đơn hàng" rowHeader="code" selectionMode="multiple" [searchable]="true" [columns]="columns" [rows]="rows"></z-data-table>
    </z-config-provider>
  `,
})
export class DataTableI18n {
  readonly columns = columns;
  readonly rows = rows;
}

```

### Case: lazy-datasource

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZDataTable, ZStack, ZTableCellTemplate } from '@zelviora/angular';
import { basicColumns, createOrderDatasource, datasourceColumns, makeOrders, statusTone, type Order } from '../data';

/**
 * Top: `ZTableCellTemplate` (`*zTableCell`) listens to `zRenderedRowsChange` so custom status badges mount only for the
 * viewport rows of a 500-row virtual table. Bottom: `datasource` fetches blocks on demand with an LRU cache, paired
 * with lazy `rowExpandable` + `renderDetail` master-detail rows.
 */
@Component({
  selector: 'demo-data-table-lazy-datasource',
  imports: [ZBadge, ZDataTable, ZStack, ZTableCellTemplate],
  template: `
    <z-stack gap="lg">
      <z-data-table
        label="Virtualized status badges (500 orders)"
        rowHeader="code"
        virtual="on"
        maxHeight="240px"
        [pageSize]="0"
        [columns]="slotColumns"
        [rows]="virtualSlotRows"
      >
        <ng-template zTableCell let-key="key" let-value="value">
          @if (key === 'status') {
            <z-badge [tone]="tone(value)">{{ value }}</z-badge>
          }
        </ng-template>
      </z-data-table>
      <z-data-table
        label="Server block datasource with lazy detail (400 orders)"
        rowHeader="code"
        [searchable]="true"
        maxHeight="260px"
        [columns]="columns"
        [datasource]="datasource"
        [rowExpandable]="canExpand"
        [renderDetail]="formatDetail"
      ></z-data-table>
    </z-stack>
  `,
})
export class DataTableLazyDatasource {
  readonly slotColumns = datasourceColumns;
  readonly virtualSlotRows = makeOrders(500);
  readonly columns = basicColumns;
  readonly datasource = createOrderDatasource();
  readonly tone = statusTone;
  readonly canExpand = (row: Order) => Array.isArray(row.lines) && row.lines.length > 0;
  readonly formatDetail = (row: Order) => `${row.code} (${row.city}) — ${row.lines.map((l) => `${l.qty}× ${l.product}`).join(', ')}`;
}

```

### Case: multi-sort

#### Angular
```typescript
import { Component, computed, signal } from '@angular/core';
import { ZDataTable, ZStack } from '@zelviora/angular';
import { basicColumns, makeOrders } from '../data';

type Sort = Array<{ key: string; direction: 'ascending' | 'descending' }>;

@Component({
  selector: 'demo-data-table-multi-sort',
  imports: [ZDataTable, ZStack],
  template: `
    <z-stack gap="sm">
      <z-data-table label="Orders by city, then total" rowHeader="code" [pageSize]="10" [columns]="columns" [rows]="rows" [sort]="sort()" (zSortChange)="sort.set($event.detail.sort)"></z-data-table>
      <span>Sort: {{ summary() }}</span>
    </z-stack>
  `,
})
export class DataTableMultiSort {
  readonly columns = basicColumns;
  readonly rows = makeOrders(30);
  readonly sort = signal<Sort>([{ key: 'city', direction: 'ascending' }, { key: 'total', direction: 'descending' }]);
  readonly summary = computed(() => this.sort().map((s) => `${s.key} ${s.direction}`).join(', ') || 'none');
}

```

### Case: pinned-rows-spanning

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZDataTable, ZStack } from '@zelviora/angular';
import { makeSpanningRows, makeSummaryRows, orderCellSpan, pinnedTopOrders, spanningColumns } from '../data';

const initialRows = makeSpanningRows();

/**
 * Sticky `pinnedTopRows` and `pinnedBottomRows` stay anchored at the top and bottom of the scroll viewport, `wrapText`
 * lets long shipping notes wrap cleanly, `cellSpan` merges notice cells across columns, `cellPartRules` highlights
 * negative totals via `::part(cell negative)`, and `error` / `errorText` renders a built-in error state when empty.
 */
@Component({
  selector: 'demo-data-table-pinned-rows-spanning',
  imports: [ZButton, ZDataTable, ZStack],
  template: `
    <z-stack gap="sm">
      <z-stack orientation="horizontal" gap="sm" alignItems="center">
        <z-button size="sm" variant="outline" tone="neutral" (click)="failed.set(!failed())">
          {{ failed() ? 'Restore rows' : 'Simulate error state' }}
        </z-button>
      </z-stack>
      <z-data-table
        class="demo-data-table-orders"
        label="Shipping manifest with pinned summary rows"
        rowHeader="code"
        [bordered]="true"
        maxHeight="340px"
        [rowHeight]="44"
        [pageSize]="0"
        [error]="failed()"
        errorText="Unable to load shipping manifest from warehouse gateway."
        [columns]="columns"
        [rows]="failed() ? empty : rows"
        [pinnedTopRows]="failed() ? empty : topRows"
        [pinnedBottomRows]="failed() ? empty : bottomRows"
        [cellSpan]="cellSpan"
      ></z-data-table>
    </z-stack>
  `,
})
export class DataTablePinnedRowsSpanning {
  readonly columns = spanningColumns;
  readonly rows = initialRows;
  readonly topRows = pinnedTopOrders;
  readonly bottomRows = makeSummaryRows(initialRows);
  readonly empty: never[] = [];
  readonly cellSpan = orderCellSpan;
  readonly failed = signal(false);
}

```

### Case: pinned

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZDataTable, ZStack } from '@zelviora/angular';
import { makeWideRows, wideColumns } from '../data';

@Component({
  selector: 'demo-data-table-pinned',
  imports: [ZDataTable, ZStack],
  template: `
    <z-stack gap="sm">
      <z-data-table label="Order metrics" rowHeader="code" maxHeight="20rem" [pageSize]="0" [columns]="columns" [rows]="rows"
        (zColumnWidthChange)="last.set($event.detail.column + ': ' + $event.detail.width + ' px')"></z-data-table>
      <span>{{ last() ? 'Last resize: ' + last() : 'Resize a column to see its new width.' }}</span>
    </z-stack>
  `,
})
export class DataTablePinned {
  readonly columns = wideColumns;
  readonly rows = makeWideRows(30);
  readonly last = signal('');
}

```

### Case: pivot-basic

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZDataTable, ZStack } from '@zelviora/angular';
import { makeSales, salesColumns } from '../data-analytics';

type PivotConfig = NonNullable<ZDataTable['pivot']>;

/**
 * `pivotMode` with a `pivot` config: one row per region, one generated column per year, revenue summed in each cell,
 * plus a "Total" column and a grand-total row.
 */
@Component({
  selector: 'demo-data-table-pivot-basic',
  imports: [ZDataTable, ZStack],
  template: `
    <z-stack gap="sm">
      <z-data-table
        label="Revenue by region and year"
        rowHeader="region"
        [pageSize]="0"
        [pivotMode]="true"
        [pivot]="pivot"
        [columns]="columns"
        [rows]="rows"
        (zPivotChange)="onPivotChange($event)"
      ></z-data-table>
      <p role="status">{{ message() }}</p>
    </z-stack>
  `,
})
export class DataTablePivotBasic {
  readonly columns = salesColumns;
  readonly rows = makeSales(96);
  readonly pivot: PivotConfig = {
    rows: ['region'],
    columns: ['year'],
    values: [{ key: 'revenue', aggFunc: 'sum', header: 'Revenue' }],
    totalColumn: true,
    totalRow: true,
  };
  readonly message = signal('Regions are rows, years are generated columns; the last column and row are totals.');

  onPivotChange(e: CustomEvent<{ pivotMode: boolean }>) {
    this.message.set(`Pivot mode is ${e.detail.pivotMode ? 'on' : 'off'}.`);
  }
}

```

### Case: pivot-formula

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZDataTable, ZStack } from '@zelviora/angular';
import { makeSales, salesFormulaColumns, weightedLineMargin } from '../data-analytics';

type PivotConfig = NonNullable<ZDataTable['pivot']>;

/**
 * Formula columns feed the pivot: Profit (`{{revenue}} - {{cost}}`) and Margin % are formulas on the source rows, the pivot sums
 * Profit and aggregates Margin % with `weightedLineMargin`. Edit the Profit formula in its column menu (`formulaEditor`) and the
 * pivot recomputes; turn pivot mode off to see the source table with its formula columns.
 */
@Component({
  selector: 'demo-data-table-pivot-formula',
  imports: [ZButton, ZDataTable, ZStack],
  template: `
    <z-stack gap="sm">
      <z-stack orientation="horizontal" gap="sm" alignItems="center">
        <z-button size="sm" [variant]="pivotOn() ? 'solid' : 'outline'" tone="neutral" (click)="pivotOn.set(!pivotOn())">
          Pivot mode: {{ pivotOn() ? 'on' : 'off' }}
        </z-button>
      </z-stack>
      <z-data-table
        label="Profit pivot built on formula columns"
        rowHeader="region"
        maxHeight="460px"
        [pageSize]="0"
        [pivotSidebar]="true"
        [rowGroupPanel]="true"
        [formulaEditor]="true"
        [pivotMode]="pivotOn()"
        [pivot]="pivot"
        [columns]="columns"
        [rows]="rows"
        (zPivotChange)="onPivotChange($event)"
        (zColumnFormulaChange)="onFormulaChange($event)"
      ></z-data-table>
      <p role="status">{{ message() }}</p>
    </z-stack>
  `,
})
export class DataTablePivotFormula {
  readonly columns = salesFormulaColumns;
  readonly rows = makeSales(96);
  readonly pivotOn = signal(true);
  readonly pivot: PivotConfig = {
    rows: ['region'],
    columns: ['year'],
    values: [
      { key: 'profit', aggFunc: 'sum', header: 'Profit' },
      { key: 'margin', aggFunc: weightedLineMargin, header: 'Margin %' },
    ],
    splitValues: true,
    totalColumn: true,
    totalRow: true,
  };
  readonly message = signal('Change the Profit formula in its header menu, for example {{revenue}} - {{cost}} - 5.');

  onPivotChange(e: CustomEvent<{ pivotMode: boolean }>) {
    this.pivotOn.set(e.detail.pivotMode);
    this.message.set(`Pivot mode is ${e.detail.pivotMode ? 'on' : 'off'}.`);
  }

  onFormulaChange(e: CustomEvent<{ column: string; formula: string | null }>) {
    this.message.set(`Formula of ${e.detail.column}: ${e.detail.formula ?? '(removed)'}; the pivot recomputed.`);
  }
}

```

### Case: pivot-groups

#### Angular
```typescript
import { Component, computed, signal } from '@angular/core';
import { ZButton, ZDataTable, ZStack } from '@zelviora/angular';
import { makeSales, salesColumns, weightedMargin } from '../data-analytics';

type PivotConfig = NonNullable<ZDataTable['pivot']>;
type TotalColumn = 'before' | 'after' | 'off';

/**
 * Two row dimensions (region, product) form an expandable tree with subtotals; revenue and units are summed and the margin
 * uses the custom aggFunc `weightedMargin`. Switch split values, the total column position, the expanded levels and the column order.
 */
@Component({
  selector: 'demo-data-table-pivot-groups',
  imports: [ZButton, ZDataTable, ZStack],
  template: `
    <z-stack gap="sm">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" [wrap]="true">
        <z-button size="sm" [variant]="splitValues() ? 'solid' : 'outline'" tone="neutral" (click)="splitValues.set(!splitValues())">
          Split values
        </z-button>
        @for (t of totals; track t) {
          <z-button size="sm" [variant]="totalColumn() === t ? 'solid' : 'outline'" tone="neutral" (click)="totalColumn.set(t)">
            Total {{ t }}
          </z-button>
        }
        <z-button size="sm" [variant]="expandLevels() === 1 ? 'solid' : 'outline'" tone="neutral" (click)="expandLevels.set(1)">Expand 1 level</z-button>
        <z-button size="sm" [variant]="expandLevels() === -1 ? 'solid' : 'outline'" tone="neutral" (click)="expandLevels.set(-1)">Expand all</z-button>
        <z-button size="sm" [variant]="sortDesc() ? 'solid' : 'outline'" tone="neutral" (click)="sortDesc.set(!sortDesc())">Years descending</z-button>
      </z-stack>
      <z-data-table
        label="Revenue, units and margin by region, product and year"
        rowHeader="region"
        maxHeight="460px"
        [pageSize]="0"
        [pivotMode]="true"
        [pivot]="pivot()"
        [columns]="columns"
        [rows]="rows"
      ></z-data-table>
      <p role="status">{{ message() }}</p>
    </z-stack>
  `,
})
export class DataTablePivotGroups {
  readonly columns = salesColumns;
  readonly rows = makeSales(96);
  readonly totals: TotalColumn[] = ['before', 'after', 'off'];
  readonly splitValues = signal(true);
  readonly totalColumn = signal<TotalColumn>('after');
  readonly expandLevels = signal(1);
  readonly sortDesc = signal(false);

  readonly pivot = computed<PivotConfig>(() => ({
    rows: ['region', 'product'],
    columns: ['year'],
    values: [
      { key: 'revenue', aggFunc: 'sum', header: 'Revenue' },
      { key: 'units', aggFunc: 'sum', header: 'Units' },
      { key: 'revenue', aggFunc: weightedMargin, header: 'Margin %' },
    ],
    splitValues: this.splitValues(),
    totalColumn: this.totalColumn() === 'before' ? 'before' : this.totalColumn() === 'after' ? 'after' : false,
    groupDefaultExpanded: this.expandLevels(),
    sortColumns: this.sortDesc() ? 'descending' : 'ascending',
  }));

  readonly message = signal('Margin % is sum(profit) / sum(revenue) of the cell rows, not the average of line margins.');
}

```

### Case: pivot-workbench

#### Angular
```typescript
import { Component, ElementRef, signal, viewChild } from '@angular/core';
import { ZButton, ZDataTable, ZStack } from '@zelviora/angular';
import { makeSales, salesColumns } from '../data-analytics';

type PivotConfig = NonNullable<ZDataTable['pivot']>;
type TableEl = HTMLElement & {
  setPivotConfig(config: PivotConfig | null): Promise<void>;
  getPivotConfig(): Promise<PivotConfig | null>;
  exportCsv(opts?: { fileName?: string }): Promise<void>;
};

const byRegion: PivotConfig = {
  rows: ['region'],
  columns: ['year'],
  values: [{ key: 'revenue', aggFunc: 'sum', header: 'Revenue' }],
  totalColumn: true,
  totalRow: true,
};
const byProduct: PivotConfig = {
  rows: ['product'],
  columns: ['channel'],
  values: [{ key: 'revenue', aggFunc: 'sum', header: 'Revenue' }, { key: 'units', aggFunc: 'sum', header: 'Units' }],
  splitValues: true,
  totalColumn: 'after',
  totalRow: true,
};

/**
 * All pivot features together: the pivot sidebar (Columns tool panel), the row group bar, the pivot panel, search, the status bar,
 * CSV export, preset buttons that call `setPivotConfig()` and a log of `zPivotChange` / `zRowGroupChange`.
 */
@Component({
  selector: 'demo-data-table-pivot-workbench',
  imports: [ZButton, ZDataTable, ZStack],
  template: `
    <z-stack gap="sm">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" [wrap]="true">
        <z-button size="sm" variant="outline" tone="neutral" (click)="preset(regionYear)">By region x year</z-button>
        <z-button size="sm" variant="outline" tone="neutral" (click)="preset(productChannel)">Product x channel</z-button>
        <z-button size="sm" variant="outline" tone="neutral" (click)="preset(null)">Detail (no pivot)</z-button>
        <z-button size="sm" variant="outline" tone="neutral" (click)="exportCsv()">Export CSV</z-button>
      </z-stack>
      <z-data-table
        #table
        label="Sales pivot workbench"
        rowHeader="region"
        maxHeight="480px"
        [pageSize]="0"
        [searchable]="true"
        [statusBar]="true"
        [pivotSidebar]="true"
        [rowGroupPanel]="true"
        [pivotPanel]="true"
        [pivotMode]="true"
        [pivot]="regionYear"
        [columns]="columns"
        [rows]="rows"
        (zPivotChange)="onPivotChange($event)"
        (zRowGroupChange)="onRowGroupChange($event)"
      ></z-data-table>
      <p role="status">{{ message() }}</p>
      <pre aria-label="Current pivot config">{{ config() }}</pre>
      <ul aria-label="Event log">
        @for (line of log(); track $index) {
          <li>{{ line }}</li>
        }
      </ul>
    </z-stack>
  `,
})
export class DataTablePivotWorkbench {
  private readonly table = viewChild.required('table', { read: ElementRef });
  readonly columns = salesColumns;
  readonly rows = makeSales(96);
  readonly regionYear = byRegion;
  readonly productChannel = byProduct;
  readonly message = signal('Open the Pivot button or the sidebar to change rows, columns and values; drag headers into the bars.');
  readonly config = signal('(pivot config appears after the first change)');
  readonly log = signal<string[]>([]);

  private push(line: string) {
    this.log.update((l) => [line, ...l].slice(0, 6));
  }

  async preset(config: PivotConfig | null) {
    await this.el().setPivotConfig(config);
    this.message.set(config ? `Preset applied: ${config.rows.join(', ')} by ${config.columns.join(', ')}.` : 'Pivot mode off: showing detail rows.');
  }

  exportCsv() {
    void this.el().exportCsv({ fileName: 'sales-pivot.csv' });
  }

  async onPivotChange(e: CustomEvent<{ pivot: PivotConfig | null; pivotMode: boolean }>) {
    this.push(`zPivotChange pivotMode=${e.detail.pivotMode}`);
    this.config.set(JSON.stringify(await this.el().getPivotConfig(), (_k, v) => (typeof v === 'function' ? 'fn' : v), 2));
  }

  onRowGroupChange(e: CustomEvent<{ groupBy: string[]; reason: string }>) {
    this.push(`zRowGroupChange groupBy=[${e.detail.groupBy.join(', ')}] (${e.detail.reason})`);
  }

  private el() {
    return this.table().nativeElement as TableEl;
  }
}

```

### Case: rtl

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDataTable } from '@zelviora/angular';
import { groupedColumns, makeOrders } from '../data';

@Component({
  selector: 'demo-data-table-rtl',
  imports: [ZDataTable],
  template: `
    <div dir="rtl">
      <z-data-table label="Orders" rowHeader="code" selectionMode="multiple" [searchable]="true" [columns]="columns" [rows]="rows"></z-data-table>
    </div>
  `,
})
export class DataTableRtl {
  readonly columns = groupedColumns;
  readonly rows = makeOrders(6);
}

```

### Case: selection

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZDataTable, ZStack } from '@zelviora/angular';
import { basicColumns, makeOrders } from '../data';

/** Locked orders cannot be selected; Space toggles a row, Shift+Arrow extends, Ctrl/Cmd+A selects all. */
@Component({
  selector: 'demo-data-table-selection',
  imports: [ZButton, ZDataTable, ZStack],
  template: `
    <z-stack gap="sm">
      <z-data-table label="Orders to invoice" rowHeader="code" selectionMode="multiple" disabledKey="locked" [columns]="columns" [rows]="rows"
        [selectedKeys]="selected()" (zSelectionChange)="selected.set($event.detail.value)"></z-data-table>
      <z-stack orientation="horizontal" gap="sm" align-items="center">
        <z-button [disabled]="!selected().length" (click)="invoice()">Invoice {{ selected().length }} orders</z-button>
        <span>{{ sent() ? 'Sent: ' + sent() : 'Locked orders (every ninth) cannot be selected.' }}</span>
      </z-stack>
    </z-stack>
  `,
})
export class DataTableSelection {
  readonly columns = basicColumns;
  readonly rows = makeOrders(10);
  readonly selected = signal<string[]>([]);
  readonly sent = signal('');
  invoice() {
    this.sent.set(this.rows.filter((r) => this.selected().includes(r.key)).map((r) => r.code).join(', '));
  }
}

```

### Case: states

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZDataTable, ZStack } from '@zelviora/angular';
import { basicColumns, makeOrders } from '../data';

@Component({
  selector: 'demo-data-table-states',
  imports: [ZButton, ZDataTable, ZStack],
  template: `
    <z-stack gap="lg">
      <z-data-table label="Loading without rows" [loading]="true" rowHeader="code" [columns]="columns" [rows]="[]"></z-data-table>
      <z-data-table label="Empty" emptyText="No orders yet" rowHeader="code" [columns]="columns" [rows]="[]"></z-data-table>
      <z-stack gap="sm" align-items="start">
        <z-button variant="outline" tone="neutral" (click)="loading.set(!loading())">{{ loading() ? 'Stop loading' : 'Reload' }}</z-button>
        <z-data-table label="Reloading keeps the rows" [loading]="loading()" rowHeader="code" [columns]="columns" [rows]="rows"></z-data-table>
      </z-stack>
      <z-data-table label="Sorted with a selection" selectionMode="multiple" [selectedKeys]="selected" [sort]="sort" rowHeader="code" [columns]="columns" [rows]="rows"></z-data-table>
    </z-stack>
  `,
})
export class DataTableStates {
  readonly columns = basicColumns;
  readonly rows = makeOrders(5);
  readonly loading = signal(false);
  readonly selected = ['o2', 'o4'];
  readonly sort = [{ key: 'customer', direction: 'ascending' as const }];
}

```

### Case: toolbar

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZDataTable } from '@zelviora/angular';
import { makeOrders, orderColumns } from '../data';

const STORE = 'demo-data-table-hidden';
const load = (): string[] => { try { return JSON.parse(localStorage.getItem(STORE) ?? '[]') as string[]; } catch { return []; } };

/** Type "lon" to find "London"; use the funnel buttons in the headers to filter a column. */
@Component({
  selector: 'demo-data-table-toolbar',
  imports: [ZButton, ZDataTable],
  template: `
    <z-data-table label="Orders" rowHeader="code" [searchable]="true" [columnToggle]="true" [columnMenu]="true" [pageSize]="10" [columns]="columns" [rows]="rows"
      [hiddenColumns]="hidden()" (zColumnVisibilityChange)="save($event.detail.hiddenColumns)">
      <z-button slot="toolbar" size="sm" variant="outline" tone="neutral">Export</z-button>
    </z-data-table>
  `,
})
export class DataTableToolbar {
  readonly columns = orderColumns;
  readonly rows = makeOrders(60);
  readonly hidden = signal<string[]>(load());
  save(next: string[]) {
    this.hidden.set(next);
    try { localStorage.setItem(STORE, JSON.stringify(next)); } catch { /* private mode */ }
  }
}

```

### Case: transactions

#### Angular
```typescript
import { Component, ElementRef, signal, viewChild } from '@angular/core';
import { ZButton, ZDataTable, ZStack } from '@zelviora/angular';
import { makeOrders, transactionColumns, type Order } from '../data';

type TableEl = HTMLElement & {
  rows: Order[];
  applyTransaction(tx: { add?: Order[]; addIndex?: number; update?: Order[]; remove?: string[] }): Promise<{
    added: Order[];
    updated: Order[];
    removed: Order[];
  }>;
};

let nextOrderSeq = 100;

/**
 * Delta updates via `applyTransaction()` add, update and remove rows in place without replacing the entire dataset,
 * flashing modified cells (`cellFlash`) while keeping focus and scroll position intact.
 */
@Component({
  selector: 'demo-data-table-transactions',
  imports: [ZButton, ZDataTable, ZStack],
  template: `
    <z-stack gap="sm">
      <z-stack orientation="horizontal" gap="sm" alignItems="center">
        <z-button size="sm" (click)="addOrder()">Add order</z-button>
        <z-button size="sm" variant="outline" tone="neutral" (click)="bumpFirstTotal()">Increase first (+$125)</z-button>
        <z-button size="sm" variant="outline" tone="destructive" (click)="removeLast()">Remove last</z-button>
      </z-stack>
      <z-data-table
        #table
        label="Live order stream"
        rowHeader="code"
        [rowKey]="rowKeyFn"
        [cellFlash]="true"
        [pageSize]="0"
        [columns]="columns"
        [rows]="rows()"
        (zCellClick)="onCellClick($event)"
      ></z-data-table>
      <p role="status">{{ status() }}</p>
    </z-stack>
  `,
})
export class DataTableTransactions {
  private readonly table = viewChild.required('table', { read: ElementRef });
  readonly columns = transactionColumns;
  readonly rows = signal<Order[]>(makeOrders(8));
  readonly status = signal('Click a cell or run a delta transaction.');
  readonly rowKeyFn = (row: Record<string, unknown>) => String(row['code']);

  async addOrder() {
    const id = ++nextOrderSeq;
    const sample = makeOrders(1)[0]!;
    const created: Order = { ...sample, key: `o${id}`, code: `DH-${String(id).padStart(4, '0')}`, total: 640 };
    const el = this.table().nativeElement as TableEl;
    const res = await el.applyTransaction({ add: [created], addIndex: 0 });
    this.status.set(`Added ${res.added.length} order (${created.code}) at index 0.`);
  }

  async bumpFirstTotal() {
    const el = this.table().nativeElement as TableEl;
    const current = el.rows ?? [];
    if (!current.length) return;
    const first = current[0]!;
    const res = await el.applyTransaction({ update: [{ ...first, total: first.total + 125 }] });
    this.status.set(`Updated ${res.updated.length} order (${first.code}) with cell flash.`);
  }

  async removeLast() {
    const el = this.table().nativeElement as TableEl;
    const current = el.rows ?? [];
    if (!current.length) return;
    const last = current[current.length - 1]!;
    const res = await el.applyTransaction({ remove: [last.code] });
    this.status.set(`Removed ${res.removed.length} order (${last.code}).`);
  }

  onCellClick(e: CustomEvent<{ rowKey: string; column: string; value: unknown }>) {
    this.status.set(`Clicked ${e.detail.column} on ${e.detail.rowKey}: ${String(e.detail.value)}`);
  }
}

```

### Case: tree

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDataTable } from '@zelviora/angular';
import { categories } from '../data';

@Component({
  selector: 'demo-data-table-tree',
  imports: [ZDataTable],
  template: `<z-data-table label="Catalog" rowHeader="name" selectionMode="multiple" [expandedKeys]="expanded" [columns]="columns" [rows]="rows"></z-data-table>`,
})
export class DataTableTree {
  readonly columns = [
    { key: 'name', header: 'Category' },
    { key: 'items', header: 'Items', type: 'number' as const },
  ];
  readonly rows = categories;
  readonly expanded = ['c1'];
}

```

### Case: virtual

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDataTable } from '@zelviora/angular';
import { basicColumns, makeOrders } from '../data';

@Component({
  selector: 'demo-data-table-virtual',
  imports: [ZDataTable],
  template: `<z-data-table label="All orders" rowHeader="code" selectionMode="multiple" virtual="on" maxHeight="24rem" [pageSize]="0" [columns]="columns" [rows]="rows"></z-data-table>`,
})
export class DataTableVirtual {
  readonly columns = basicColumns;
  readonly rows = makeOrders(10_000);
}

```

### Case: wide

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDataTable } from '@zelviora/angular';
import { dailyColumns, makeDailyRows } from '../data';

/** 201 columns × 1000 rows: only the cells in view render (rows and columns); End / Ctrl+End scroll to the cell. */
@Component({
  selector: 'demo-data-table-wide',
  imports: [ZDataTable],
  template: `<z-data-table label="Daily sales" rowHeader="store" virtual="on" virtualColumns="on" maxHeight="24rem" [pageSize]="0" [columns]="columns" [rows]="rows"></z-data-table>`,
})
export class DataTableWide {
  readonly columns = dailyColumns;
  readonly rows = makeDailyRows(1000);
}

```


================================================================================
# COMPONENT: DATE-PICKER
================================================================================

## Documentation

# date-picker — Angular

Processed requirements of [`<z-date-picker>`](../../../../../requirements/04-components/form/date-picker.md) for Angular
(`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SelectValueAccessor, ZDatePicker } from '@zelviora/angular';

@Component({
  selector: 'app-dob',
  imports: [FormsModule, SelectValueAccessor, ZDatePicker],
  template: `<z-date-picker name="dob" label="Date of birth" [(ngModel)]="dob"></z-date-picker>`,
})
export class Dob { dob: string | null = null; }
```

## Binding

| Component | Value accessor | Model | Event | Detail |
|---|---|---|---|---|
| `ZDatePicker` | `SelectValueAccessor` (spec §12: `select`, string value) | `[(ngModel)]` / `formControl` (`string \| null`) | `(zChange)` | `{ value }` |
| `ZDatePicker` | — | `[open]` (no two-way binding, D-031) | `(zOpenChange)` | `{ open, reason }` |

The accessor applies `ValidityValidator`: `required`, `min`/`max` (`rangeUnderflow`/`rangeOverflow`), a half-typed date
(`badInput`) and blocked dates (`customError`) reach the Angular control errors.

## Events

`(zChange)`, `(zMonthChange)` (`{ month: 'YYYY-MM' }`), `(zOpenChange)`, `(zBeforeOpen)` / `(zBeforeClose)` (cancelable),
`(zClear)`, `(zAfterOpen)`, `(zAfterClose)`. No `zInput`. Function inputs: `[isDateUnavailable]`, `[isTimeUnavailable]`.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `date-picker-default.ts` | D-1 Default (`today` fixed), D-15 Keyboard-only (hint) |
| `variants` | `date-picker-variants.ts` | D-3 Variants, D-5 Sizes |
| `states` | `date-picker-states.ts` | D-6 States, D-7 Disabled, D-14 Long content |
| `validation` | `date-picker-validation.ts` | D-8 Error (required, outside min/max, 31/02) |
| `controlled` | `date-picker-controlled.ts` | D-9 Controlled (`[value]` + `(zChange)`) |
| `form` | `date-picker-form.ts` | D-10 In form, D-17 Composition (field) |
| `i18n` | `date-picker-i18n.ts` | D-19 i18n (vi, en-US, ja), D-11 RTL (ar-EG) |
| `customization` | `date-picker-customization.ts` | D-18 Customization (`::part(calendar-cell-selected)`) |
| `dialog` | `date-picker-dialog.ts` | D-21 Popup dialog |
| `month-year` | `date-picker-month-year.ts` | D-22 Month / year picker |
| `two-months` | `date-picker-two-months.ts` | D-23 Two months |
| `unavailable` | `date-picker-unavailable.ts` | D-24 Unavailable dates, D-20 (replaced by blocked dates) |
| `date-time` | `date-picker-date-time.ts` | D-25 Date + time (`[(ngModel)]`) |

D-2 Playground, D-12 Dark, D-13 Brand showcase and D-16 Density come from the docs site switchers; D-4 Tones does not
apply. The `customization` demo uses the `demo-date-picker-brand` rule of `demo.css` (same rule as the React README).

## Differences

- The calendar is internal to the date picker (no separate calendar element yet).
- Bind boolean and number inputs with `[prop]="…"` (`[showTime]="true"`, `[numberOfMonths]="2"`).
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZDatePicker, ZStack } from '@zelviora/angular';

/** The app owns `value`: buttons set it from code (no event), the log lists user changes and month changes. */
@Component({
  selector: 'demo-date-picker-controlled',
  imports: [ZButton, ZDatePicker, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-date-picker
        label="Deadline"
       
        today="2026-10-02"
        [value]="value()"
        (zChange)="value.set($event.detail.value); add('zChange ' + $event.detail.value)"
        (zMonthChange)="add('zMonthChange ' + $event.detail.month)"
      ></z-date-picker>
      <z-stack orientation="horizontal" gap="sm" [wrap]="true">
        <z-button variant="outline" tone="neutral" (click)="value.set('2026-12-31')">Set Dec 31, 2026</z-button>
        <z-button variant="outline" tone="neutral" (click)="value.set(null)">Clear</z-button>
      </z-stack>
      <span>Value: {{ value() ?? 'null' }}</span>
      <output>{{ log().join(' · ') }}</output>
    </z-stack>
  `,
})
export class DatePickerControlled {
  readonly value = signal<string | null>('2026-10-15');
  readonly log = signal<string[]>([]);

  add(line: string) {
    this.log.update((l) => [line, ...l].slice(0, 5));
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDatePicker } from '@zelviora/angular';

/** Component tokens and calendar parts (`::part(calendar-cell-selected)`): see the `demo-date-picker-brand` rule in README. */
@Component({
  selector: 'demo-date-picker-customization',
  imports: [ZDatePicker],
  template: `
    <z-date-picker class="demo-narrow demo-date-picker-brand" label="Appointment date" today="2026-10-02" value="2026-10-15"></z-date-picker>
  `,
})
export class DatePickerCustomization {}

```

### Case: date-time

#### Angular
```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SelectValueAccessor, ZDatePicker, ZStack } from '@zelviora/angular';

/** Date and time: 15-minute steps, office hours only (08:00–17:00); confirm with OK. */
@Component({
  selector: 'demo-date-picker-date-time',
  imports: [FormsModule, SelectValueAccessor, ZDatePicker, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-date-picker
        label="Appointment"
       
        today="2026-10-02"
        [showTime]="true"
        [minuteStep]="15"
        [isTimeUnavailable]="officeHours"
        [(ngModel)]="value"
      ></z-date-picker>
      <span>Value: {{ value ?? 'null' }}</span>
    </z-stack>
  `,
})
export class DatePickerDateTime {
  value: string | null = null;
  readonly officeHours = (time: string) => time < '08:00' || time > '17:00';
}

```

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SelectValueAccessor, ZDatePicker, ZStack } from '@zelviora/angular';

/**
 * Type the day, month and year, or open the calendar; "today" is fixed so the demo never changes.
 * `[(ngModel)]` through SelectValueAccessor (model event `zChange`, string value or null).
 */
@Component({
  selector: 'demo-date-picker-default',
  imports: [FormsModule, SelectValueAccessor, ZDatePicker, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-date-picker label="Date of birth" today="2026-10-02" hint="Type month/day/year or press Alt+↓ to open the calendar" [clearable]="true" [(ngModel)]="value"></z-date-picker>
      <span>Value: {{ value ?? 'null' }}</span>
    </z-stack>
  `,
})
export class DatePickerDefault {
  value: string | null = null;
}

```

### Case: dialog

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDatePicker } from '@zelviora/angular';

/** Modal dialog popup (default on touch screens with popupMode "auto"): focus stays inside, a Close button. */
@Component({
  selector: 'demo-date-picker-dialog',
  imports: [ZDatePicker],
  template: `
    <z-date-picker class="demo-narrow" label="Check-in date" today="2026-10-02" popupMode="dialog"></z-date-picker>
  `,
})
export class DatePickerDialog {}

```

### Case: form

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZDatePicker, ZField, ZStack } from '@zelviora/angular';

/**
 * Native form: the value is submitted as YYYY-MM-DD (FormData), required inside a field, reset restores defaults.
 * FormsModule is not imported, so the form stays native and the element submits its own FormData entry.
 */
@Component({
  selector: 'demo-date-picker-form',
  imports: [ZButton, ZDatePicker, ZField, ZStack],
  template: `
    <form class="demo-narrow" (submit)="submit($event)">
      <z-stack>
        <z-field label="Delivery date" hint="Monday to Friday" [required]="true">
          <z-date-picker name="delivery" today="2026-10-02" min="2026-10-02" [required]="true"></z-date-picker>
        </z-field>
        <z-date-picker name="birthday" label="Date of birth" today="2026-10-02" value="2026-10-15"></z-date-picker>
        <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
          <z-button type="submit">Submit</z-button>
          <z-button type="reset" variant="outline" tone="neutral">Reset</z-button>
        </z-stack>
        @if (sent()) {
          <output>{{ sent() }}</output>
        }
      </z-stack>
    </form>
  `,
})
export class DatePickerForm {
  readonly sent = signal('');

  submit(e: Event) {
    e.preventDefault();
    this.sent.set(JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]));
  }
}

```

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDatePicker, ZGrid } from '@zelviora/angular';

/** Segment order, names and first day of the week follow the locale; Arabic (RTL) keeps Latin digits. */
@Component({
  selector: 'demo-date-picker-i18n',
  imports: [ZDatePicker, ZGrid],
  template: `
    <z-grid columns="1 sm:2" gap="md">
      <z-date-picker label="Tiếng Việt (dd/mm/yyyy, thứ Hai)" locale="vi" today="2026-10-02" value="2026-10-15"></z-date-picker>
      <z-date-picker label="English US (mm/dd/yyyy, Sunday)" locale="en-US" today="2026-10-02" value="2026-10-15"></z-date-picker>
      <z-date-picker label="日本語 (yyyy/mm/dd)" locale="ja" today="2026-10-02" value="2026-10-15"></z-date-picker>
      <div dir="rtl" lang="ar-EG">
        <z-date-picker label="العربية" locale="ar-EG" today="2026-10-02" value="2026-10-15"></z-date-picker>
      </div>
    </z-grid>
  `,
})
export class DatePickerI18n {}

```

### Case: month-year

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDatePicker, ZStack } from '@zelviora/angular';

/** Month picker (YYYY-MM) and year picker (YYYY): the popup shows months or years. */
@Component({
  selector: 'demo-date-picker-month-year',
  imports: [ZDatePicker, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-date-picker label="Reporting period" today="2026-10-02" granularity="month" value="2026-10"></z-date-picker>
      <z-date-picker label="Fiscal year" today="2026-10-02" granularity="year" value="2026"></z-date-picker>
    </z-stack>
  `,
})
export class DatePickerMonthYear {}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDatePicker, ZGrid } from '@zelviora/angular';

/** Empty, filled, disabled, readonly, invalid and display statuses; a long label in a narrow column wraps. */
@Component({
  selector: 'demo-date-picker-states',
  imports: [ZDatePicker, ZGrid],
  template: `
    <z-grid columns="1 sm:2" gap="md">
      <z-date-picker label="Empty" today="2026-10-02"></z-date-picker>
      <z-date-picker label="With value" today="2026-10-02" value="2026-10-15"></z-date-picker>
      <z-date-picker label="Disabled" today="2026-10-02" value="2026-10-15" [disabled]="true"></z-date-picker>
      <z-date-picker label="Readonly" today="2026-10-02" value="2026-10-15" [readonly]="true"></z-date-picker>
      <z-date-picker label="Invalid" today="2026-10-02" value="2026-10-15" [invalid]="true"></z-date-picker>
      <z-date-picker label="Warning" today="2026-10-02" value="2026-10-15" status="warning"></z-date-picker>
      <z-date-picker label="Success" today="2026-10-02" value="2026-10-15" status="success"></z-date-picker>
      <z-date-picker
        class="demo-narrow"
        label="Expected date to complete the whole business registration file and submit it to the regulator"
       
        today="2026-10-02"
        value="2026-10-15"
      ></z-date-picker>
    </z-grid>
  `,
})
export class DatePickerStates {}

```

### Case: two-months

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDatePicker } from '@zelviora/angular';

/** Two months side by side with ISO week numbers. */
@Component({
  selector: 'demo-date-picker-two-months',
  imports: [ZDatePicker],
  template: `
    <z-date-picker class="demo-narrow" label="Departure date" today="2026-10-02" value="2026-10-15" [numberOfMonths]="2" [weekNumbers]="true"></z-date-picker>
  `,
})
export class DatePickerTwoMonths {}

```

### Case: unavailable

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDatePicker } from '@zelviora/angular';

/** Day of the week of a calendar date (Sakamoto), 0 = Sunday: no Date, no time zone. */
const T = [0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4];
const isWeekend = (date: string) => {
  const [y0, m, d] = date.split('-').map(Number) as [number, number, number];
  const y = m < 3 ? y0 - 1 : y0;
  const day = (y + Math.floor(y / 4) - Math.floor(y / 100) + Math.floor(y / 400) + T[m - 1]! + d) % 7;
  return day === 0 || day === 6;
};

/** Weekends cannot be picked; typing one gives a custom error. The footer slot adds a note. */
@Component({
  selector: 'demo-date-picker-unavailable',
  imports: [ZDatePicker],
  template: `
    <z-date-picker class="demo-narrow" label="Working day" today="2026-10-02" [isDateUnavailable]="isWeekend">
      <span slot="footer">Monday – Friday only</span>
    </z-date-picker>
  `,
})
export class DatePickerUnavailable {
  readonly isWeekend = isWeekend;
}

```

### Case: validation

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZDatePicker, ZStack } from '@zelviora/angular';

/** Required, a range (min / max) and a date that does not exist (type 02/31/2026 then leave the field). */
@Component({
  selector: 'demo-date-picker-validation',
  imports: [ZButton, ZDatePicker, ZStack],
  template: `
    <form class="demo-narrow" (submit)="$event.preventDefault()">
      <z-stack>
        <z-date-picker name="start" label="Start date" today="2026-10-02" [required]="true"></z-date-picker>
        <z-date-picker name="trip" label="Departure (within 2026)" today="2026-10-02" min="2026-01-01" max="2026-12-31" value="2025-12-20"></z-date-picker>
        <z-date-picker name="any" label="Try 02/31/2026" today="2026-10-02" hint="A date that does not exist is a bad input"></z-date-picker>
        <z-button type="submit">Submit</z-button>
      </z-stack>
    </form>
  `,
})
export class DatePickerValidation {}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDatePicker, ZGrid } from '@zelviora/angular';

/** Outline and filled field in every size. */
@Component({
  selector: 'demo-date-picker-variants',
  imports: [ZDatePicker, ZGrid],
  template: `
    <z-grid columns="1 sm:3" gap="md">
      <z-date-picker label="Small" size="sm" today="2026-10-02" value="2026-10-15"></z-date-picker>
      <z-date-picker label="Medium" size="md" today="2026-10-02" value="2026-10-15"></z-date-picker>
      <z-date-picker label="Large" size="lg" today="2026-10-02" value="2026-10-15"></z-date-picker>
      <z-date-picker label="Small filled" size="sm" variant="filled" today="2026-10-02"></z-date-picker>
      <z-date-picker label="Medium filled" size="md" variant="filled" today="2026-10-02"></z-date-picker>
      <z-date-picker label="Large filled" size="lg" variant="filled" today="2026-10-02"></z-date-picker>
    </z-grid>
  `,
})
export class DatePickerVariants {}

```


================================================================================
# COMPONENT: DATE-RANGE-PICKER
================================================================================

## Documentation

# date-range-picker — Angular

Processed requirements of [`<z-date-range-picker>`](../../../../../requirements/04-components/form/date-range-picker.md) for Angular
(`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SelectValueAccessor, ZDateRangePicker } from '@zelviora/angular';

@Component({
  selector: 'app-demo',
  imports: [FormsModule, SelectValueAccessor, ZDateRangePicker],
  template: `<z-date-range-picker name="stay" label="Stay dates" [(ngModel)]="range"></z-date-range-picker>`,
})
export class Demo {
  range: [string | null, string | null] = [null, null];
}
```

## Binding

| Component | Value accessor | Model | Event | Detail |
|---|---|---|---|---|
| `ZDateRangePicker` | `SelectValueAccessor` (spec §12: `select, tuple value`) | `[(ngModel)]` / `formControl` (`[string \| null, string \| null]`) | `(zChange)` | `{ value }` |
| `ZDateRangePicker` | — | `[open]` (no two-way binding, D-031) | `(zOpenChange)` | `{ open, reason }` |

Other events: `(zMonthChange)` (`{ month: 'YYYY-MM' }`), `(zBeforeOpen)` / `(zBeforeClose)` (cancelable), `(zClear)`, `(zAfterOpen)`, `(zAfterClose)`. `zChange` fires only for a complete range or a clear: a half-picked range updates `value` without an event.
`value` and `defaultValue` are arrays (properties); `start` / `end` attributes mirror both ends. `isDateUnavailable` (alias `disabledDate`) is a function property; `minDate` / `maxDate` alias `min` / `max`; `splitPanels` enables independent month navigation across the two calendar panels.

The accessor applies `ValidityValidator`: `required`, `min`/`max`, `minDays`/`maxDays`, an end before the start and blocked dates (`customError`) reach the Angular control errors.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `date-range-picker-default.ts` | D-1 Default (`today` fixed), D-15 Keyboard-only (hint) |
| `variants` | `date-range-picker-variants.ts` | D-3 Variants, D-5 Sizes |
| `states` | `date-range-picker-states.ts` | D-6 States, D-7 Disabled, D-14 Long content |
| `validation` | `date-range-picker-validation.ts` | D-8 Error (required, outside min/max, end before start) |
| `controlled` | `date-range-picker-controlled.ts` | D-9 Controlled |
| `form` | `date-range-picker-form.ts` | D-10 In form (two entries), D-17 Composition (field) |
| `i18n` | `date-range-picker-i18n.ts` | D-19 i18n (vi, en-US, ja), D-11 RTL (ar-EG) |
| `customization` | `date-range-picker-customization.ts` | D-18 Customization (`::part(calendar-cell-in-range)`) |
| `presets` | `date-range-picker-presets.ts` | D-25 Presets |
| `max-days` | `date-range-picker-max-days.ts` | D-26 `max-days=30` (with `min-days=2`) |
| `unavailable` | `date-range-picker-unavailable.ts` | D-27 Range across blocked dates, D-24 Unavailable dates |
| `one-month` | `date-range-picker-one-month.ts` | D-28 Narrow viewport (one month), D-21 Popup dialog |

D-2 Playground, D-12 Dark, D-13 Brand showcase and D-16 Density come from the docs site switchers; D-4 Tones and D-20 Empty / loading do not apply.

The `customization` demo uses the `demo-date-range-picker-brand` rule of `demo.css` (same rule as the React README).

## Differences

- Narrow screens (≤ 40rem) always show one month, read at each opening.
- The form gets two entries with the same `name` (`start`, `end`), only when the range is complete.
- Bind boolean and number inputs with `[prop]="…"` (`[required]="true"`).
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZDateRangePicker, ZStack } from '@zelviora/angular';

type DateRange = [string | null, string | null];

/** The app owns `value`: buttons set it from code (no event); a half-picked range is not a change. */
@Component({
  selector: 'demo-date-range-picker-controlled',
  imports: [ZButton, ZDateRangePicker, ZStack],
  template: `
    <z-stack>
      <z-date-range-picker
        label="Reporting period"
       
        today="2026-10-02"
        [value]="value()"
        (zChange)="value.set($event.detail.value); add('zChange ' + json($event.detail.value))"
        (zMonthChange)="add('zMonthChange ' + $event.detail.month)"
      ></z-date-range-picker>
      <z-stack orientation="horizontal" gap="sm" [wrap]="true">
        <z-button variant="outline" tone="neutral" (click)="value.set(['2026-11-01', '2026-11-30'])">Set November</z-button>
        <z-button variant="outline" tone="neutral" (click)="value.set([null, null])">Clear</z-button>
      </z-stack>
      <span>Value: {{ json(value()) }}</span>
      <output>{{ log().join(' · ') }}</output>
    </z-stack>
  `,
})
export class DateRangePickerControlled {
  readonly value = signal<DateRange>(['2026-10-05', '2026-10-09']);
  readonly log = signal<string[]>([]);
  readonly json = JSON.stringify;

  add(line: string) {
    this.log.update((l) => [line, ...l].slice(0, 5));
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDateRangePicker } from '@zelviora/angular';

/** Component tokens and range parts (`::part(calendar-cell-in-range)`): see the `demo-date-range-picker-brand` rule in README. */
@Component({
  selector: 'demo-date-range-picker-customization',
  imports: [ZDateRangePicker],
  template: `
    <z-date-range-picker class="demo-date-range-picker-brand" label="Time off" today="2026-10-02" start="2026-10-05" end="2026-10-09"></z-date-range-picker>
  `,
})
export class DateRangePickerCustomization {}

```

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SelectValueAccessor, ZDateRangePicker, ZStack } from '@zelviora/angular';

/**
 * Type both dates, or open the calendar and click a start and an end day; "today" is fixed so the demo never changes.
 * `[(ngModel)]` through SelectValueAccessor (model event `zChange`, value `[start, end]`).
 */
@Component({
  selector: 'demo-date-range-picker-default',
  imports: [FormsModule, SelectValueAccessor, ZDateRangePicker, ZStack],
  template: `
    <z-stack>
      <z-date-range-picker label="Time off" today="2026-10-02" hint="Type month/day/year or press Alt+↓ to open the calendar" [clearable]="true" [(ngModel)]="value"></z-date-range-picker>
      <span>Value: {{ json(value) }}</span>
    </z-stack>
  `,
})
export class DateRangePickerDefault {
  value: [string | null, string | null] = [null, null];
  readonly json = JSON.stringify;
}

```

### Case: form

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZDateRangePicker, ZField, ZStack } from '@zelviora/angular';

/**
 * Native form: two FormData entries with the same name (start, end); required inside a field; reset restores defaults.
 * FormsModule is not imported, so the form stays native and the element submits its own FormData entries.
 */
@Component({
  selector: 'demo-date-range-picker-form',
  imports: [ZButton, ZDateRangePicker, ZField, ZStack],
  template: `
    <form (submit)="submit($event)">
      <z-stack>
        <z-field label="Stay dates" hint="Check-in – check-out" [required]="true">
          <z-date-range-picker name="stay" today="2026-10-02" min="2026-10-02" [required]="true"></z-date-range-picker>
        </z-field>
        <z-date-range-picker name="period" label="Billing period" today="2026-10-02" start="2026-10-01" end="2026-10-31"></z-date-range-picker>
        <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
          <z-button type="submit">Submit</z-button>
          <z-button type="reset" variant="outline" tone="neutral">Reset</z-button>
        </z-stack>
        @if (sent()) {
          <output>{{ sent() }}</output>
        }
      </z-stack>
    </form>
  `,
})
export class DateRangePickerForm {
  readonly sent = signal('');

  submit(e: Event) {
    e.preventDefault();
    this.sent.set(JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]));
  }
}

```

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDateRangePicker, ZGrid } from '@zelviora/angular';

/** Segment order, names and first day of the week follow the locale; Arabic (RTL) mirrors the fields and the calendar. */
@Component({
  selector: 'demo-date-range-picker-i18n',
  imports: [ZDateRangePicker, ZGrid],
  template: `
    <z-grid columns="1 md:2" gap="md">
      <z-date-range-picker label="Tiếng Việt" locale="vi" today="2026-10-02" start="2026-10-05" end="2026-10-09"></z-date-range-picker>
      <z-date-range-picker label="English US" locale="en-US" today="2026-10-02" start="2026-10-05" end="2026-10-09"></z-date-range-picker>
      <z-date-range-picker label="日本語" locale="ja" today="2026-10-02" start="2026-10-05" end="2026-10-09"></z-date-range-picker>
      <div dir="rtl" lang="ar-EG">
        <z-date-range-picker label="العربية" locale="ar-EG" today="2026-10-02" start="2026-10-05" end="2026-10-09"></z-date-range-picker>
      </div>
    </z-grid>
  `,
})
export class DateRangePickerI18n {}

```

### Case: max-days

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDateRangePicker } from '@zelviora/angular';

/** A stay of 2 to 30 days: after the first click, days that would make the range too short or too long are disabled. */
@Component({
  selector: 'demo-date-range-picker-max-days',
  imports: [ZDateRangePicker],
  template: `
    <z-date-range-picker label="Room booking" today="2026-10-02" min="2026-10-02" [minDays]="2" [maxDays]="30" hint="Minimum 2 days, maximum 30 days"></z-date-range-picker>
  `,
})
export class DateRangePickerMaxDays {}

```

### Case: one-month

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDateRangePicker } from '@zelviora/angular';

/** One month at a time in a modal dialog, as on a narrow touch screen. */
@Component({
  selector: 'demo-date-range-picker-one-month',
  imports: [ZDateRangePicker],
  template: `
    <z-date-range-picker class="demo-narrow" label="Business trips" today="2026-10-02" [numberOfMonths]="1" popupMode="dialog"></z-date-range-picker>
  `,
})
export class DateRangePickerOneMonth {}

```

### Case: presets

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZDateRangePicker, ZStack } from '@zelviora/angular';

type DateRange = [string | null, string | null];

/** Quick ranges in the presets slot set `value` (today is fixed at 2026-10-02). */
@Component({
  selector: 'demo-date-range-picker-presets',
  imports: [ZButton, ZDateRangePicker, ZStack],
  template: `
    <z-stack>
      <z-date-range-picker label="Date range" today="2026-10-02" [value]="value()" (zChange)="value.set($event.detail.value)">
        <z-stack slot="presets" gap="xs">
          <z-button size="sm" variant="ghost" tone="neutral" (click)="value.set(['2026-09-26', '2026-10-02'])">Last 7 days</z-button>
          <z-button size="sm" variant="ghost" tone="neutral" (click)="value.set(['2026-09-03', '2026-10-02'])">Last 30 days</z-button>
          <z-button size="sm" variant="ghost" tone="neutral" (click)="value.set(['2026-10-01', '2026-10-31'])">This month</z-button>
          <z-button size="sm" variant="ghost" tone="neutral" (click)="value.set(['2026-09-01', '2026-09-30'])">Last month</z-button>
        </z-stack>
      </z-date-range-picker>
      <span>Value: {{ json(value()) }}</span>
    </z-stack>
  `,
})
export class DateRangePickerPresets {
  readonly value = signal<DateRange>([null, null]);
  readonly json = JSON.stringify;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDateRangePicker, ZGrid } from '@zelviora/angular';

/** Empty, filled, disabled, readonly, invalid and display statuses; a long label in a narrow column wraps. */
@Component({
  selector: 'demo-date-range-picker-states',
  imports: [ZDateRangePicker, ZGrid],
  template: `
    <z-grid columns="1 sm:2" gap="md">
      <z-date-range-picker label="Empty" today="2026-10-02"></z-date-range-picker>
      <z-date-range-picker label="With value" today="2026-10-02" start="2026-10-05" end="2026-10-09"></z-date-range-picker>
      <z-date-range-picker label="Disabled" today="2026-10-02" start="2026-10-05" end="2026-10-09" [disabled]="true"></z-date-range-picker>
      <z-date-range-picker label="Readonly" today="2026-10-02" start="2026-10-05" end="2026-10-09" [readonly]="true"></z-date-range-picker>
      <z-date-range-picker label="Invalid" today="2026-10-02" start="2026-10-05" end="2026-10-09" [invalid]="true"></z-date-range-picker>
      <z-date-range-picker label="Warning" today="2026-10-02" start="2026-10-05" end="2026-10-09" status="warning"></z-date-range-picker>
      <z-date-range-picker label="Success" today="2026-10-02" start="2026-10-05" end="2026-10-09" status="success"></z-date-range-picker>
      <z-date-range-picker
        class="demo-narrow"
        label="Expected period to roll out the whole system at all branches in the southern region"
       
        today="2026-10-02"
        start="2026-10-05"
        end="2026-10-09"
      ></z-date-range-picker>
    </z-grid>
  `,
})
export class DateRangePickerStates {}

```

### Case: unavailable

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDateRangePicker, ZGrid } from '@zelviora/angular';

const BOOKED = new Set(['2026-10-10', '2026-10-11', '2026-10-12']);

/** Booked days (Oct 10–12, 2026) cannot be picked; the second picker allows a range across them. */
@Component({
  selector: 'demo-date-range-picker-unavailable',
  imports: [ZDateRangePicker, ZGrid],
  template: `
    <z-grid columns="1 md:2" gap="md">
      <z-date-range-picker label="Room 101" today="2026-10-02" [isDateUnavailable]="isBooked">
        <span slot="footer">Fully booked Oct 10–12</span>
      </z-date-range-picker>
      <z-date-range-picker label="Room 101 (allow booked days inside the range)" today="2026-10-02" [isDateUnavailable]="isBooked" [allowUnavailableInRange]="true"></z-date-range-picker>
    </z-grid>
  `,
})
export class DateRangePickerUnavailable {
  readonly isBooked = (date: string) => BOOKED.has(date);
}

```

### Case: validation

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZDateRangePicker, ZStack } from '@zelviora/angular';

/** Required, a min/max range, and an end typed before the start (type 10/10/2026 – 05/10/2026). */
@Component({
  selector: 'demo-date-range-picker-validation',
  imports: [ZButton, ZDateRangePicker, ZStack],
  template: `
    <form (submit)="$event.preventDefault()">
      <z-stack>
        <z-date-range-picker name="trip" label="Trip" today="2026-10-02" [required]="true"></z-date-range-picker>
        <z-date-range-picker
          name="season"
          label="Within 2026"
         
          today="2026-10-02"
          min="2026-01-01"
          max="2026-12-31"
          start="2026-12-28"
          end="2027-01-03"
        ></z-date-range-picker>
        <z-date-range-picker name="any" label="Try an end date before the start date" today="2026-10-02" start="2026-10-10" end="2026-10-05"></z-date-range-picker>
        <z-button type="submit">Submit</z-button>
      </z-stack>
    </form>
  `,
})
export class DateRangePickerValidation {}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDateRangePicker, ZGrid } from '@zelviora/angular';

/** Outline and filled field in every size. */
@Component({
  selector: 'demo-date-range-picker-variants',
  imports: [ZDateRangePicker, ZGrid],
  template: `
    <z-grid columns="1 sm:2" gap="md">
      <z-date-range-picker label="Small" size="sm" today="2026-10-02" start="2026-10-05" end="2026-10-09"></z-date-range-picker>
      <z-date-range-picker label="Small filled" size="sm" variant="filled" today="2026-10-02"></z-date-range-picker>
      <z-date-range-picker label="Medium" size="md" today="2026-10-02" start="2026-10-05" end="2026-10-09"></z-date-range-picker>
      <z-date-range-picker label="Medium filled" size="md" variant="filled" today="2026-10-02"></z-date-range-picker>
      <z-date-range-picker label="Large" size="lg" today="2026-10-02" start="2026-10-05" end="2026-10-09"></z-date-range-picker>
      <z-date-range-picker label="Large filled" size="lg" variant="filled" today="2026-10-02"></z-date-range-picker>
    </z-grid>
  `,
})
export class DateRangePickerVariants {}

```


================================================================================
# COMPONENT: DESCRIPTIONS
================================================================================

## Documentation

# descriptions — Angular

Processed requirements of [`<z-descriptions>`](../../../../../requirements/04-components/data-display/descriptions.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-descriptions heading="Customer" [columns]="2">
  <z-descriptions-item label="Name">Anna Lee</z-descriptions-item>
  <z-descriptions-item label="Email">a@example.com</z-descriptions-item>
</z-descriptions>
```

## Binding

No model event. `items` (data mode) is an array set as a property. Search keyword: "Descriptions", "key-value", "details" (antd `Descriptions`).

## Events

None.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `descriptions-basic.ts` | D-1 Default |
| `variants` | `descriptions-variants.ts` | D-3 Variants |
| `sizes` | `descriptions-sizes.ts` | D-5 Sizes, D-16 Density |
| `data` | `descriptions-data.ts` | D-6 States, D-14 Long content, D-19 i18n |
| `composition` | `descriptions-composition.ts` | D-17 Composition, D-15 Keyboard-only |
| `responsive` | `descriptions-responsive.ts` | D-21 Responsive columns, D-18 Customization |

## Customization

The `responsive` demo uses this rule of the demo stylesheet:

```css
.demo-descriptions-columns {
  --z-descriptions-columns: 2;
}
@media (min-width: 64rem) {
  .demo-descriptions-columns {
    --z-descriptions-columns: 4;
  }
}
```


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDescriptions, ZDescriptionsItem } from '@zelviora/angular';

@Component({
  selector: 'demo-descriptions-basic',
  imports: [ZDescriptions, ZDescriptionsItem],
  template: `
    <z-descriptions heading="Customer">
      <z-descriptions-item label="Full name">Anna Lee</z-descriptions-item>
      <z-descriptions-item label="Email">a@example.com</z-descriptions-item>
      <z-descriptions-item label="Phone">0912 345 678</z-descriptions-item>
      <z-descriptions-item label="City">London</z-descriptions-item>
      <z-descriptions-item label="Plan">Business</z-descriptions-item>
      <z-descriptions-item label="Customer since">03/2021</z-descriptions-item>
    </z-descriptions>
  `,
})
export class DescriptionsBasic {}

```

### Case: composition

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZCard, ZDescriptions, ZDescriptionsItem, ZLink, ZTag } from '@zelviora/angular';

@Component({
  selector: 'demo-descriptions-composition',
  imports: [ZBadge, ZButton, ZCard, ZDescriptions, ZDescriptionsItem, ZLink, ZTag],
  template: `
    <z-card>
      <z-descriptions heading="Project" [headingLevel]="2">
        <z-button slot="actions" size="sm" variant="outline" tone="neutral">Edit</z-button>
        <z-descriptions-item label="Status"><z-badge tone="success">Active</z-badge></z-descriptions-item>
        <z-descriptions-item label="Tags"><z-tag>design</z-tag> <z-tag>web</z-tag></z-descriptions-item>
        <z-descriptions-item label="Repository"><z-link href="#repo">github.com/acme/site</z-link></z-descriptions-item>
        <z-descriptions-item label="Owner">Mark Tran</z-descriptions-item>
      </z-descriptions>
    </z-card>
  `,
})
export class DescriptionsComposition {}

```

### Case: data

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDescriptions } from '@zelviora/angular';

@Component({
  selector: 'demo-descriptions-data',
  imports: [ZDescriptions],
  template: `
    <z-descriptions heading="Invoice" [items]="items" [bordered]="true"></z-descriptions>
  `,
})
export class DescriptionsData {
  readonly items = [
    { label: 'Invoice', value: 'INV-2026-0042' },
    { label: 'Issued', value: '05/10/2026' },
    { label: 'Due', value: '' },
    { label: 'Note', value: 'https://example.com/invoices/2026/october/INV-2026-0042-with-a-very-long-path', span: 'full' as const },
  ];
}

```

### Case: responsive

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDescriptions, ZDescriptionsItem } from '@zelviora/angular';

@Component({
  selector: 'demo-descriptions-responsive',
  imports: [ZDescriptions, ZDescriptionsItem],
  template: `
    <z-descriptions heading="Auto columns" class="demo-descriptions-columns">
      <z-descriptions-item label="CPU">8 vCPU</z-descriptions-item>
      <z-descriptions-item label="Memory">32 GB</z-descriptions-item>
      <z-descriptions-item label="Disk">500 GB SSD</z-descriptions-item>
      <z-descriptions-item label="Region">ap-southeast-1</z-descriptions-item>
      <z-descriptions-item label="Zone">a</z-descriptions-item>
      <z-descriptions-item label="Uptime">99.98%</z-descriptions-item>
      <z-descriptions-item label="Created">01/09/2026</z-descriptions-item>
      <z-descriptions-item label="Owner">ops</z-descriptions-item>
    </z-descriptions>
  `,
})
export class DescriptionsResponsive {}

```

### Case: sizes

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDescriptions, ZDescriptionsItem, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-descriptions-sizes',
  imports: [ZDescriptions, ZDescriptionsItem, ZStack],
  template: `
    <z-stack gap="lg">
      @for (size of sizes; track size) {
        <z-descriptions [heading]="'Size ' + size" [size]="size" [bordered]="true" [columns]="2">
          <z-descriptions-item label="Order">DH-0001</z-descriptions-item>
          <z-descriptions-item label="Total">$1,250.00</z-descriptions-item>
        </z-descriptions>
      }
    </z-stack>
  `,
})
export class DescriptionsSizes {
  readonly sizes = ['sm', 'md', 'lg'] as const;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDescriptions, ZDescriptionsItem, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-descriptions-variants',
  imports: [ZDescriptions, ZDescriptionsItem, ZStack],
  template: `
    <z-stack gap="lg">
      <z-descriptions heading="Vertical" layout="vertical" [columns]="3">
        <z-descriptions-item label="Order">DH-0001</z-descriptions-item>
        <z-descriptions-item label="Status">Shipped</z-descriptions-item>
        <z-descriptions-item label="Total">$1,250.00</z-descriptions-item>
      </z-descriptions>
      <z-descriptions heading="Bordered" [bordered]="true" [columns]="2">
        <z-descriptions-item label="Order">DH-0001</z-descriptions-item>
        <z-descriptions-item label="Status">Shipped</z-descriptions-item>
        <z-descriptions-item label="Total">$1,250.00</z-descriptions-item>
        <z-descriptions-item label="Paid by">Card</z-descriptions-item>
        <z-descriptions-item label="Address" span="full">12 Baker Street, Marylebone, London</z-descriptions-item>
      </z-descriptions>
    </z-stack>
  `,
})
export class DescriptionsVariants {}

```


================================================================================
# COMPONENT: DIALOG
================================================================================

## Documentation

# dialog — Angular

Processed requirements of [`<z-dialog>`](../../../../../requirements/04-components/overlay-feedback/dialog.md) for Angular
(`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component } from '@angular/core';
import { ZButton, ZDialog } from '@zelviora/angular';

@Component({
  selector: 'app-rename',
  imports: [ZButton, ZDialog],
  template: `
    <z-dialog heading="Rename project">
      <z-button slot="trigger">Rename</z-button>
      …
      <z-button slot="footer" data-z-dialog-close>Cancel</z-button>
    </z-dialog>
  `,
})
export class Rename {}
```

## Binding

`open` is controlled with `[open]` + `(zOpenChange)`. There is no `[(open)]`: the output is named `zOpenChange`, not
`openChange` (06-wrappers/angular §3). Setting `open` emits no event; the methods `show()` / `hide()` emit
`zBeforeOpen` / `zBeforeClose` with reason `programmatic`.

## Events

`(zBeforeOpen)`, `(zBeforeClose)` (cancelable: `$event.preventDefault()`), `(zOpenChange)` (`{ open, reason }`),
`(zAfterOpen)`, `(zAfterClose)`, `(zConfirm)`, `(zCancel)`.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `dialog-default.ts` | D-1 Default, D-23 Description |
| `controlled` | `dialog-controlled.ts` | D-9 Controlled |
| `non-modal` | `dialog-non-modal.ts` | D-21 Non-modal |

## Differences

- `controlled` keeps `open` in a signal (React: state); the description says "component state" instead of "React state".
- `<form method="dialog">` in light DOM does not close the dialog: use `data-z-dialog-close` or `hide()`.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZDialog, ZField, ZInput, ZStack, ZTag, ZText } from '@zelviora/angular';
import type { ZDialogOpenChangeDetail } from '@zelviora/core';

@Component({
  selector: 'demo-dialog-controlled',
  imports: [ZButton, ZDialog, ZField, ZInput, ZStack, ZTag, ZText],
  template: `
    <z-stack gap="sm">
      <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
        <z-button (click)="open.set(true)">Open from state</z-button>
        <z-tag size="sm">open: {{ open() }}</z-tag>
      </z-stack>
      <z-dialog heading="Rename project" [open]="open()" [showFooter]="true" confirmLabel="Save" (zOpenChange)="onOpenChange($event.detail)">
        <z-field label="New name">
          <z-input name="name" autofocus></z-input>
        </z-field>
      </z-dialog>
      @if (log().length > 0) {
        <z-stack gap="xs">
          @for (l of log(); track $index) {
            <z-text size="sm" variant="muted">{{ l }}</z-text>
          }
        </z-stack>
      }
    </z-stack>
  `,
})
export class DialogControlled {
  readonly open = signal(false);
  readonly log = signal<string[]>([]);

  onOpenChange(detail: ZDialogOpenChangeDetail) {
    this.open.set(detail.open);
    this.log.update((l) => [...l, `${detail.open ? 'opened' : 'closed'} (${detail.reason})`]);
  }
}

```

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZDialog, ZText } from '@zelviora/angular';

@Component({
  selector: 'demo-dialog-default',
  imports: [ZButton, ZDialog, ZText],
  template: `
    <z-dialog heading="Project details" description="Summary of the current project." [showFooter]="true" [hideCancel]="true" confirmLabel="Close">
      <z-button slot="trigger">Open dialog</z-button>
      <z-text as="p">The project was created on 2 October 2026 and has 12 members.</z-text>
    </z-dialog>
  `,
})
export class DialogDefault {}

```

### Case: non-modal

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZDialog, ZText } from '@zelviora/angular';

@Component({
  selector: 'demo-dialog-non-modal',
  imports: [ZButton, ZDialog, ZText],
  template: `
    <z-dialog heading="Keyboard shortcuts" [nonModal]="true" size="sm">
      <z-button slot="trigger" variant="outline" tone="neutral">Show shortcuts</z-button>
      <z-text as="p">The page stays interactive and scrollable while this dialog is open. Press Escape to close it.</z-text>
    </z-dialog>
  `,
})
export class DialogNonModal {}

```


================================================================================
# COMPONENT: DONUT-CHART
================================================================================

## Documentation

# Donut chart (`<z-donut-chart>`)

Ring-shaped proportional breakdown chart with configurable inner and outer radii.

## Installation & Import

```tsx
// React (@zelviora/react-chart)
import { ZDonutChart } from '@zelviora/react-chart';

// Vue 3 (@zelviora/vue-chart)
import { ZDonutChart } from '@zelviora/vue-chart';

// Angular (@zelviora/angular-chart)
import { ZDonutChart } from '@zelviora/angular-chart';

// Web Components (@zelviora/chart)
import '@zelviora/chart';
```

## Key Features

- **Tree-shaken ECharts 6 Core**: Automatically registers only the required ECharts chart module and components.
- **Design System Token Synchronization**: Reads `--z-chart-series-1..8`, `--z-chart-grid-color`, and `--z-chart-axis-color`, reacting automatically to Light/Dark mode and theme preset changes.
- **Built-in Accessibility (WCAG AAA)**: Renders a semantic `<figure>` with `<figcaption>`, interactive `aria-pressed` legend toggles, and a synchronized `<table>` for screen readers.
- **Escape Hatch (`option`)**: Deep-merges any raw ECharts `option` object on top of the declarative props.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDonutChart } from '@zelviora/angular-chart';
import { costData, costSeries } from '../data';

@Component({
  selector: 'demo-donut-chart-basic',
  imports: [ZDonutChart],
  template: `
    <z-donut-chart
      heading="Monthly Cloud Cost Allocation (USD)"
      description="Compute and Database clusters account for the majority of monthly cloud spend."
      xKey="service" [data]="data" [series]="series"
    ></z-donut-chart>
  `,
})
export class DonutChartBasic {
  readonly data = costData;
  readonly series = costSeries;
}

```

### Case: controlled

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/angular';
import { ZDonutChart, type ChartPointSelectDetail, type ChartSeriesToggleDetail } from '@zelviora/angular-chart';
import { costData, costSeries } from '../data';

@Component({
  selector: 'demo-donut-chart-controlled',
  imports: [ZStack, ZButton, ZBadge, ZText, ZDonutChart],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <z-button size="sm" variant="outline" (click)="hidden = []">
          Show All Series
        </z-button>
        <z-badge tone="primary" variant="soft">{{ selected }}</z-badge>
        <z-text variant="muted" size="sm">
          Hidden: {{ hidden.length ? hidden.join(', ') : 'none' }}
        </z-text>
      </z-stack>
      <z-donut-chart
        heading="Monthly Cloud Cost Allocation (USD) (Interactive)"
        description="Compute and Database clusters account for the majority of monthly cloud spend."
        xKey="service" [data]="data" [series]="series"
        [selectable]="true"
        [hiddenSeries]="hidden"
        (zSeriesToggle)="onToggle($event)"
        (zPointSelect)="onSelect($event)"
      ></z-donut-chart>
    </z-stack>
  `,
})
export class DonutChartControlled {
  readonly data = costData;
  readonly series = costSeries;
  hidden: string[] = [];
  selected = 'Click any chart element to inspect';

  onToggle(e: CustomEvent<ChartSeriesToggleDetail>) {
    this.hidden = e.detail.hiddenSeries;
  }

  onSelect(e: CustomEvent<ChartPointSelectDetail>) {
    this.selected = `Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`;
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZDonutChart } from '@zelviora/angular-chart';
import { costData, costSeries } from '../data';

@Component({
  selector: 'demo-donut-chart-customization',
  imports: [ZDonutChart],
  template: `
    <z-donut-chart
      class="demo-chart-brand"
      description="Compute and Database clusters account for the majority of monthly cloud spend."
      [valueFormat]="{ maximumFractionDigits: 1 }"
      xKey="service" [data]="data" [series]="series" innerRadius="55%" [padAngle]="4" [startAngle]="90" renderer="canvas"
    >
      <span slot="heading">Monthly Cloud Cost Allocation (USD) — Custom Theme Tokens &amp; Canvas</span>
    </z-donut-chart>
  `,
})
export class DonutChartCustomization {
  readonly data = costData;
  readonly series = costSeries;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZDonutChart } from '@zelviora/angular-chart';
import { costData, costSeries } from '../data';

@Component({
  selector: 'demo-donut-chart-states',
  imports: [ZStack, ZDonutChart],
  template: `
    <z-stack gap="lg">
      <z-donut-chart
        heading="Loading State (aria-busy)"
        [loading]="true"
        xKey="service" [data]="data" [series]="series"
      ></z-donut-chart>
      <z-donut-chart
        heading="Empty State"
        [data]="[]"
        [series]="series"
      ></z-donut-chart>
      <z-donut-chart
        heading="Expanded Accessible Data Table"
        description="Compute and Database clusters account for the majority of monthly cloud spend."
        [showDataTable]="true"
        xKey="service" [data]="data" [series]="series"
      ></z-donut-chart>
    </z-stack>
  `,
})
export class DonutChartStates {
  readonly data = costData;
  readonly series = costSeries;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZDonutChart } from '@zelviora/angular-chart';
import { costData, costSeries } from '../data';

@Component({
  selector: 'demo-donut-chart-variants',
  imports: [ZStack, ZDonutChart],
  template: `
    <z-stack gap="lg">
      <z-donut-chart
        heading="Slim Padded Ring"
        description="Slim ring with angular padding vs thicker ring with external labels hidden."
        xKey="service" [data]="data" [series]="series" innerRadius="62%" outerRadius="78%" [padAngle]="3"
      ></z-donut-chart>
      <z-donut-chart
        heading="Compact Thick Ring"
        description="Slim ring with angular padding vs thicker ring with external labels hidden."
        xKey="service" [data]="data" [series]="series" innerRadius="35%" outerRadius="72%" [showLabel]="false"
      ></z-donut-chart>
    </z-stack>
  `,
})
export class DonutChartVariants {
  readonly data = costData;
  readonly series = costSeries;
}

```


================================================================================
# COMPONENT: DRAWER
================================================================================

## Documentation

# drawer — Angular

Processed requirements of [`<z-drawer>`](../../../../../requirements/04-components/overlay-feedback/drawer.md) for Angular
(`@zelviora/angular`, standalone components, Angular >= 21). Other libraries call it Sheet (shadcn), Drawer (Ant Design,
PrimeNG) or side sheet (Material).

## Usage

```ts
@Component({
  selector: 'app-filters',
  imports: [ZButton, ZDrawer],
  template: `
    <z-drawer heading="Filters" placement="end">
      <z-button slot="trigger">Filters</z-button>
      …
      <z-button slot="footer" data-z-dialog-close>Close</z-button>
    </z-drawer>
  `,
})
export class Filters {}
```

## Binding

| Component | Value accessor | Model | Event | Detail |
|---|---|---|---|---|
| `ZDrawer` | — | `[open]` (no two-way binding, D-031) | `(zOpenChange)` | `{ open, reason }` |

## Events

`(zBeforeOpen)`, `(zBeforeClose)` (cancelable), `(zOpenChange)`, `(zAfterOpen)`, `(zAfterClose)`.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `drawer-default.ts` | D-1 Default, D-18 Customization (extra slot) |
| `placements` | `drawer-placements.ts` | D-3 Variants (4 placements), D-11 RTL |
| `sizes` | `drawer-sizes.ts` | D-5 Sizes, D-14 Long content |
| `controlled` | `drawer-controlled.ts` | D-9 Controlled |
| `nested` | `drawer-nested.ts` | D-17 Composition (push), D-6 States (pushed) |
| `form` | `drawer-form.ts` | D-10 In form, D-8 Error (block closing) |

## Differences

- Swipe to close, snap points and resizing are not available in v1.


## Examples & Implementation

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import type { ZDrawerOpenChangeDetail } from '@zelviora/core';
import { ZButton, ZDrawer, ZStack } from '@zelviora/angular';

/** `[open]` held in a signal and updated from zOpenChange, which reports the reason (no two-way `open`, D-031). */
@Component({
  selector: 'demo-drawer-controlled',
  imports: [ZButton, ZDrawer, ZStack],
  template: `
    <z-stack gap="sm">
      <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
        <z-button (click)="open.set(true)">Open from state</z-button>
        <span>open: {{ open() }}</span>
      </z-stack>
      <z-drawer heading="Filters" [open]="open()" (zOpenChange)="onOpenChange($event.detail)">
        <p>Status, owner and date filters go here.</p>
        <z-button slot="footer" variant="outline" tone="neutral" (click)="open.set(false)">Cancel</z-button>
        <z-button slot="footer" (click)="open.set(false)">Apply</z-button>
      </z-drawer>
      <ul>
        @for (l of log(); track $index) {
          <li>{{ l }}</li>
        }
      </ul>
    </z-stack>
  `,
})
export class DrawerControlled {
  readonly open = signal(false);
  readonly log = signal<string[]>([]);

  onOpenChange(detail: ZDrawerOpenChangeDetail) {
    this.open.set(detail.open);
    this.log.update((l) => [...l, `${detail.open ? 'opened' : 'closed'} (${detail.reason})`]);
  }
}

```

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZDrawer } from '@zelviora/angular';

/** A modal drawer from the end edge: page inert, focus returns to the trigger when it closes. */
@Component({
  selector: 'demo-drawer-default',
  imports: [ZButton, ZDrawer],
  template: `
    <z-drawer heading="Order #1024" description="Placed on 2 October 2026.">
      <z-button slot="trigger">Open drawer</z-button>
      <p>3 items, delivery to London. Use Escape, the close button or the backdrop to close.</p>
      <z-button slot="actions" variant="ghost" tone="neutral" size="sm">Print</z-button>
      <z-button slot="footer" variant="outline" tone="neutral" data-z-dialog-close>Close</z-button>
      <z-button slot="footer" data-z-dialog-close>Confirm</z-button>
    </z-drawer>
  `,
})
export class DrawerDefault {}

```

### Case: form

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import type { ZDrawerOpenChangeDetail } from '@zelviora/core';
import { ZButton, ZDrawer, ZInput, ZStack } from '@zelviora/angular';

/**
 * An edit form in a drawer: Save submits the form; closing is blocked while the form has unsaved changes.
 * FormsModule is not imported, so the form stays native.
 */
@Component({
  selector: 'demo-drawer-form',
  imports: [ZButton, ZDrawer, ZInput, ZStack],
  template: `
    <z-stack gap="sm">
      <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
        <z-button (click)="open.set(true)">Edit profile</z-button>
        <span>Name: {{ saved() }}</span>
      </z-stack>
      <z-drawer
        heading="Edit profile"
        [description]="dirty() ? 'Unsaved changes: save or reset before closing.' : undefined"
        [open]="open()"
        (zBeforeClose)="beforeClose($event)"
        (zOpenChange)="onOpenChange($event.detail)"
      >
        <form id="drawer-profile" (reset)="dirty.set(false)" (submit)="submit($event)">
          <z-input name="name" label="Full name" [required]="true" [value]="saved()" (zInput)="dirty.set(true)"></z-input>
        </form>
        <z-button slot="footer" type="reset" form="drawer-profile" variant="outline" tone="neutral">Reset</z-button>
        <z-button slot="footer" type="submit" form="drawer-profile">Save</z-button>
      </z-drawer>
    </z-stack>
  `,
})
export class DrawerForm {
  readonly open = signal(false);
  readonly dirty = signal(false);
  readonly saved = signal('Mark Tran');

  beforeClose(e: Event) {
    if (this.dirty()) e.preventDefault();
  }

  onOpenChange(detail: ZDrawerOpenChangeDetail) {
    this.open.set(detail.open);
  }

  submit(e: Event) {
    e.preventDefault();
    this.saved.set(String(new FormData(e.currentTarget as HTMLFormElement).get('name') ?? ''));
    this.dirty.set(false);
    this.open.set(false);
  }
}

```

### Case: nested

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZDrawer } from '@zelviora/angular';

/** A drawer opened inside another one: the parent moves aside (pushed); Escape closes the top one only. */
@Component({
  selector: 'demo-drawer-nested',
  imports: [ZButton, ZDrawer],
  template: `
    <z-drawer heading="Order #1024" size="lg">
      <z-button slot="trigger">Open order</z-button>
      <p>Customer: Anna Lee.</p>
      <z-drawer heading="Customer" size="sm">
        <z-button slot="trigger" variant="outline" tone="neutral">Customer details</z-button>
        <p>Phone, address and order history.</p>
        <z-button slot="footer" data-z-dialog-close>Back to order</z-button>
      </z-drawer>
    </z-drawer>
  `,
})
export class DrawerNested {}

```

### Case: placements

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZConfigProvider, ZDrawer, ZStack } from '@zelviora/angular';

/** The four logical edges; in RTL `start` is the right edge. */
@Component({
  selector: 'demo-drawer-placements',
  imports: [ZButton, ZConfigProvider, ZDrawer, ZStack],
  template: `
    <z-stack orientation="horizontal" [wrap]="true" gap="sm">
      @for (p of placements; track p) {
        <z-drawer [heading]="'Placement ' + p" [placement]="p">
          <z-button slot="trigger" variant="outline" tone="neutral">{{ p }}</z-button>
          <p>This drawer slides in from the {{ p }} edge.</p>
        </z-drawer>
      }
      <z-config-provider dir="rtl" lang="ar">
        <z-drawer heading="البداية" placement="start">
          <z-button slot="trigger" variant="outline" tone="neutral">start (RTL)</z-button>
          <p>في الاتجاه من اليمين إلى اليسار تكون البداية على اليمين.</p>
        </z-drawer>
      </z-config-provider>
    </z-stack>
  `,
})
export class DrawerPlacements {
  readonly placements = ['start', 'end', 'top', 'bottom'] as const;
}

```

### Case: sizes

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZDrawer, ZStack } from '@zelviora/angular';

/** Width steps (height for top/bottom); never wider than the viewport. Long content scrolls in the body. */
@Component({
  selector: 'demo-drawer-sizes',
  imports: [ZButton, ZDrawer, ZStack],
  template: `
    <z-stack orientation="horizontal" [wrap]="true" gap="sm">
      @for (s of sizes; track s) {
        <z-drawer [heading]="'Size ' + s" [size]="s">
          <z-button slot="trigger" variant="outline" tone="neutral">{{ s }}</z-button>
          @for (i of paragraphs; track i) {
            <p>Paragraph {{ i }}: the body scrolls while the header and footer stay.</p>
          }
          <z-button slot="footer" data-z-dialog-close>Done</z-button>
        </z-drawer>
      }
    </z-stack>
  `,
})
export class DrawerSizes {
  readonly sizes = ['sm', 'md', 'lg', 'xl', 'full'] as const;
  readonly paragraphs = Array.from({ length: 30 }, (_, i) => i + 1);
}

```


================================================================================
# COMPONENT: DROPDOWN-MENU
================================================================================

## Documentation

# dropdown-menu — Angular

Processed requirements of [`<z-dropdown-menu>` and the `z-menu-*` items](../../../../../requirements/04-components/overlay-feedback/dropdown-menu.md)
for Angular (`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component } from '@angular/core';
import { ZButton, ZDropdownMenu, ZMenuItem, ZMenuSeparator } from '@zelviora/angular';

@Component({
  selector: 'app-actions',
  imports: [ZButton, ZDropdownMenu, ZMenuItem, ZMenuSeparator],
  template: `
    <z-dropdown-menu (zSelect)="run($event.detail.value)">
      <z-button slot="trigger">Actions</z-button>
      <z-menu-item value="edit">Edit</z-menu-item>
      <z-menu-separator></z-menu-separator>
      <z-menu-item value="delete" tone="destructive">Delete</z-menu-item>
    </z-dropdown-menu>
  `,
})
export class Actions { run(value: string) {} }
```

## Binding

Menu items are not form controls: no value accessor, bind the input + the event.

| Component | Input | Event | Detail |
|---|---|---|---|
| `ZDropdownMenu` | `[open]` (no two-way binding, D-031) | `(zOpenChange)` | `{ open, reason }` |
| `ZMenuCheckboxItem` | `[checked]` | `(zChange)` | `{ checked, value }` |
| `ZMenuRadioGroup` | `[value]` | `(zChange)` | `{ value }` |

`(zSelect)` (`{ value, item }`, cancelable: `preventDefault()` keeps the menu open) is emitted by every item and
bubbles to `ZDropdownMenu`.

## Events

`(zSelect)`, `(zOpenChange)`, `(zBeforeOpen)` / `(zBeforeClose)` (cancelable), `(zAfterOpen)`, `(zAfterClose)` on `ZDropdownMenu`; `(zChange)` on checkbox items and radio groups.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `dropdown-menu-default.ts` | D-1 Default, D-4 Tones, D-7 Disabled (item), D-21 Shortcuts |
| `variants` | `dropdown-menu-variants.ts` | D-3 Variants (checkbox, radio, group, separator, submenu), D-6 States |
| `controlled` | `dropdown-menu-controlled.ts` | D-9 Controlled, D-7 Disabled (trigger) |
| `i18n` | `dropdown-menu-i18n.ts` | D-19 i18n (typeahead on Vietnamese labels) |

## Differences

- Boolean and number props are bound with `[prop]="…"` (`[loading]="true"`), so the value reaches the element with its type.
- The content stays at its DOM position (top layer, no portal): it inherits theme and direction from where it is placed.
- Opening on hover (`openOn`) is not available (deferred in the spec).
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZDropdownMenu, ZMenuItem, ZStack } from '@zelviora/angular';

/** Controlled `open` (+ `zOpenChange`), a disabled menu and typeahead ("r" finds "Rename"). */
@Component({
  selector: 'demo-dropdown-menu-controlled',
  imports: [ZButton, ZDropdownMenu, ZMenuItem, ZStack],
  template: `
    <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="md">
      <z-dropdown-menu [open]="open()" (zOpenChange)="open.set($event.detail.open)">
        <z-button slot="trigger" variant="outline" tone="neutral">File</z-button>
        <z-menu-item value="open">Open</z-menu-item>
        <z-menu-item value="rename">Rename</z-menu-item>
        <z-menu-item value="close">Close</z-menu-item>
      </z-dropdown-menu>
      <z-button variant="ghost" tone="neutral" (click)="open.set(true)">Open from code</z-button>
      <z-dropdown-menu [disabled]="true">
        <z-button slot="trigger" variant="outline" tone="neutral" [disabled]="true">Disabled</z-button>
        <z-menu-item>Never shown</z-menu-item>
      </z-dropdown-menu>
      <span>{{ open() ? 'Open' : 'Closed' }}</span>
    </z-stack>
  `,
})
export class DropdownMenuControlled {
  readonly open = signal(false);
}

```

### Case: default

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZDropdownMenu, ZMenuItem, ZMenuSeparator, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-dropdown-menu-default',
  imports: [ZButton, ZDropdownMenu, ZMenuItem, ZMenuSeparator, ZStack],
  template: `
    <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="md">
      <z-dropdown-menu (zSelect)="last.set($event.detail.value)">
        <z-button slot="trigger" variant="outline" tone="neutral">Actions</z-button>
        <z-menu-item value="edit">Edit<kbd slot="shortcut">⌘E</kbd></z-menu-item>
        <z-menu-item value="duplicate">Duplicate<kbd slot="shortcut">⌘D</kbd></z-menu-item>
        <z-menu-item value="archive" [disabled]="true">Archive</z-menu-item>
        <z-menu-separator></z-menu-separator>
        <z-menu-item value="delete" tone="destructive">Delete</z-menu-item>
      </z-dropdown-menu>
      <span>{{ last() ? 'Last action: ' + last() : 'No action yet' }}</span>
    </z-stack>
  `,
})
export class DropdownMenuDefault {
  readonly last = signal('');
}

```

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZDropdownMenu, ZMenuItem } from '@zelviora/angular';

/** `lang="vi"`: typeahead on Vietnamese labels ("đ" finds "Đổi tên"). */
@Component({
  selector: 'demo-dropdown-menu-i18n',
  imports: [ZButton, ZDropdownMenu, ZMenuItem],
  template: `
    <z-dropdown-menu lang="vi">
      <z-button slot="trigger" variant="outline" tone="neutral">Tệp</z-button>
      <z-menu-item value="open">Mở</z-menu-item>
      <z-menu-item value="rename">Đổi tên</z-menu-item>
      <z-menu-item value="close">Đóng</z-menu-item>
    </z-dropdown-menu>
  `,
})
export class DropdownMenuI18n {}

```

### Case: variants

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import {
  ZButton, ZDropdownMenu, ZMenuCheckboxItem, ZMenuGroup, ZMenuItem, ZMenuLabel, ZMenuRadioGroup, ZMenuRadioItem, ZMenuSeparator, ZMenuSub, ZStack,
} from '@zelviora/angular';

/** Menu items are not form controls (no value accessor): bind `[checked]` / `[value]` + `(zChange)`. */
@Component({
  selector: 'demo-dropdown-menu-variants',
  imports: [
    ZButton, ZDropdownMenu, ZMenuCheckboxItem, ZMenuGroup, ZMenuItem, ZMenuLabel, ZMenuRadioGroup, ZMenuRadioItem, ZMenuSeparator, ZMenuSub, ZStack,
  ],
  template: `
    <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="md">
      <z-dropdown-menu>
        <z-button slot="trigger" variant="outline" tone="neutral">View</z-button>
        <z-menu-group>
          <z-menu-label>Show</z-menu-label>
          <z-menu-checkbox-item [checked]="grid()" [keepOpenOnSelect]="true" (zChange)="grid.set($event.detail.checked)">Grid</z-menu-checkbox-item>
          <z-menu-checkbox-item [checked]="ruler()" [keepOpenOnSelect]="true" (zChange)="ruler.set($event.detail.checked)">Ruler</z-menu-checkbox-item>
        </z-menu-group>
        <z-menu-separator></z-menu-separator>
        <z-menu-radio-group [value]="density()" (zChange)="density.set($event.detail.value)">
          <z-menu-label>Density</z-menu-label>
          <z-menu-radio-item value="comfortable">Comfortable</z-menu-radio-item>
          <z-menu-radio-item value="compact">Compact</z-menu-radio-item>
        </z-menu-radio-group>
        <z-menu-separator></z-menu-separator>
        <z-menu-sub>
          <z-menu-item slot="trigger">Share</z-menu-item>
          <z-menu-item value="mail">Email link</z-menu-item>
          <z-menu-item value="copy">Copy link</z-menu-item>
          <z-menu-item value="docs" href="#dropdown-menu" target="_blank">Open docs</z-menu-item>
        </z-menu-sub>
      </z-dropdown-menu>
      <span>Grid {{ grid() ? 'on' : 'off' }}, ruler {{ ruler() ? 'on' : 'off' }}, {{ density() }}</span>
    </z-stack>
  `,
})
export class DropdownMenuVariants {
  readonly grid = signal(true);
  readonly ruler = signal(false);
  readonly density = signal('comfortable');
}

```


================================================================================
# COMPONENT: ECHARTS
================================================================================

## Documentation

# Universal ECharts (`<z-echarts>`)

Universal ECharts component supporting all 25 declarative chart types and raw ECharts option objects.

## Installation & Import

```tsx
// React (@zelviora/react-chart)
import { ZEcharts } from '@zelviora/react-chart';

// Vue 3 (@zelviora/vue-chart)
import { ZEcharts } from '@zelviora/vue-chart';

// Angular (@zelviora/angular-chart)
import { ZEcharts } from '@zelviora/angular-chart';

// Web Components (@zelviora/chart)
import '@zelviora/chart';
```

## Key Features

- **Tree-shaken ECharts 6 Core**: Automatically registers only the required ECharts chart module and components.
- **Design System Token Synchronization**: Reads `--z-chart-series-1..8`, `--z-chart-grid-color`, and `--z-chart-axis-color`, reacting automatically to Light/Dark mode and theme preset changes.
- **Built-in Accessibility (WCAG AAA)**: Renders a semantic `<figure>` with `<figcaption>`, interactive `aria-pressed` legend toggles, and a synchronized `<table>` for screen readers.
- **Escape Hatch (`option`)**: Deep-merges any raw ECharts `option` object on top of the declarative props.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZEcharts } from '@zelviora/angular-chart';
import { universalData, universalSeries } from '../data';

@Component({
  selector: 'demo-echarts-basic',
  imports: [ZEcharts],
  template: `
    <z-echarts
      heading="Universal Declarative & Option-Driven Chart"
      description="Switch between any of the 25 chart types or pass a full ECharts option configuration."
      type="bar" xKey="quarter" [data]="data" [series]="series"
    ></z-echarts>
  `,
})
export class EchartsBasic {
  readonly data = universalData;
  readonly series = universalSeries;
}

```

### Case: controlled

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/angular';
import { ZEcharts, type ChartPointSelectDetail, type ChartSeriesToggleDetail } from '@zelviora/angular-chart';
import { universalData, universalSeries } from '../data';

@Component({
  selector: 'demo-echarts-controlled',
  imports: [ZStack, ZButton, ZBadge, ZText, ZEcharts],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <z-button size="sm" variant="outline" (click)="hidden = []">
          Show All Series
        </z-button>
        <z-badge tone="primary" variant="soft">{{ selected }}</z-badge>
        <z-text variant="muted" size="sm">
          Hidden: {{ hidden.length ? hidden.join(', ') : 'none' }}
        </z-text>
      </z-stack>
      <z-echarts
        heading="Universal Declarative & Option-Driven Chart (Interactive)"
        description="Switch between any of the 25 chart types or pass a full ECharts option configuration."
        type="bar" xKey="quarter" [data]="data" [series]="series"
        [selectable]="true"
        [hiddenSeries]="hidden"
        (zSeriesToggle)="onToggle($event)"
        (zPointSelect)="onSelect($event)"
      ></z-echarts>
    </z-stack>
  `,
})
export class EchartsControlled {
  readonly data = universalData;
  readonly series = universalSeries;
  hidden: string[] = [];
  selected = 'Click any chart element to inspect';

  onToggle(e: CustomEvent<ChartSeriesToggleDetail>) {
    this.hidden = e.detail.hiddenSeries;
  }

  onSelect(e: CustomEvent<ChartPointSelectDetail>) {
    this.selected = `Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`;
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZEcharts } from '@zelviora/angular-chart';
import { universalData, universalSeries } from '../data';

@Component({
  selector: 'demo-echarts-customization',
  imports: [ZEcharts],
  template: `
    <z-echarts
      class="demo-chart-brand"
      description="Switch between any of the 25 chart types or pass a full ECharts option configuration."
      [valueFormat]="{ maximumFractionDigits: 1 }"
      type="combo" xKey="quarter" [data]="data" [series]="series" [dataZoom]="true" renderer="canvas"
    >
      <span slot="heading">Universal Declarative & Option-Driven Chart — Custom Theme Tokens &amp; Canvas</span>
    </z-echarts>
  `,
})
export class EchartsCustomization {
  readonly data = universalData;
  readonly series = universalSeries;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZEcharts } from '@zelviora/angular-chart';
import { universalData, universalSeries } from '../data';

@Component({
  selector: 'demo-echarts-states',
  imports: [ZStack, ZEcharts],
  template: `
    <z-stack gap="lg">
      <z-echarts
        heading="Loading State (aria-busy)"
        [loading]="true"
        type="bar" xKey="quarter" [data]="data" [series]="series"
      ></z-echarts>
      <z-echarts
        heading="Empty State"
        [data]="[]"
        [series]="series"
      ></z-echarts>
      <z-echarts
        heading="Expanded Accessible Data Table"
        description="Switch between any of the 25 chart types or pass a full ECharts option configuration."
        [showDataTable]="true"
        type="bar" xKey="quarter" [data]="data" [series]="series"
      ></z-echarts>
    </z-stack>
  `,
})
export class EchartsStates {
  readonly data = universalData;
  readonly series = universalSeries;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZEcharts } from '@zelviora/angular-chart';
import { universalData, universalSeries } from '../data';

@Component({
  selector: 'demo-echarts-variants',
  imports: [ZStack, ZEcharts],
  template: `
    <z-stack gap="lg">
      <z-echarts
        heading="Area Mode (type=area)"
        description="Rendering as a smooth Area chart vs a proportional Donut chart using the type prop."
        type="area" xKey="quarter" [data]="data" [series]="series" [smooth]="true"
      ></z-echarts>
      <z-echarts
        heading="Line Mode (type=line)"
        description="Rendering as a smooth Area chart vs a proportional Donut chart using the type prop."
        type="line" xKey="quarter" [data]="data" [series]="series" [smooth]="true" [dataZoom]="true"
      ></z-echarts>
    </z-stack>
  `,
})
export class EchartsVariants {
  readonly data = universalData;
  readonly series = universalSeries;
}

```


================================================================================
# COMPONENT: EFFECT-SCATTER-CHART
================================================================================

## Documentation

# Effect scatter chart (`<z-effect-scatter-chart>`)

Animated ripple scatter chart for highlighting real-time anomalies and critical threshold alerts.

## Installation & Import

```tsx
// React (@zelviora/react-chart)
import { ZEffectScatterChart } from '@zelviora/react-chart';

// Vue 3 (@zelviora/vue-chart)
import { ZEffectScatterChart } from '@zelviora/vue-chart';

// Angular (@zelviora/angular-chart)
import { ZEffectScatterChart } from '@zelviora/angular-chart';

// Web Components (@zelviora/chart)
import '@zelviora/chart';
```

## Key Features

- **Tree-shaken ECharts 6 Core**: Automatically registers only the required ECharts chart module and components.
- **Design System Token Synchronization**: Reads `--z-chart-series-1..8`, `--z-chart-grid-color`, and `--z-chart-axis-color`, reacting automatically to Light/Dark mode and theme preset changes.
- **Built-in Accessibility (WCAG AAA)**: Renders a semantic `<figure>` with `<figcaption>`, interactive `aria-pressed` legend toggles, and a synchronized `<table>` for screen readers.
- **Escape Hatch (`option`)**: Deep-merges any raw ECharts `option` object on top of the declarative props.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZEffectScatterChart } from '@zelviora/angular-chart';
import { anomalyData, anomalySeries } from '../data';

@Component({
  selector: 'demo-effect-scatter-chart-basic',
  imports: [ZEffectScatterChart],
  template: `
    <z-effect-scatter-chart
      heading="Regional Anomaly Detection Spikes"
      description="Animated ripple markers highlight peak error rates across primary and failover zones."
      xKey="window" [data]="data" [series]="series"
    ></z-effect-scatter-chart>
  `,
})
export class EffectScatterChartBasic {
  readonly data = anomalyData;
  readonly series = anomalySeries;
}

```

### Case: controlled

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/angular';
import { ZEffectScatterChart, type ChartPointSelectDetail, type ChartSeriesToggleDetail } from '@zelviora/angular-chart';
import { anomalyData, anomalySeries } from '../data';

@Component({
  selector: 'demo-effect-scatter-chart-controlled',
  imports: [ZStack, ZButton, ZBadge, ZText, ZEffectScatterChart],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <z-button size="sm" variant="outline" (click)="hidden = []">
          Show All Series
        </z-button>
        <z-badge tone="primary" variant="soft">{{ selected }}</z-badge>
        <z-text variant="muted" size="sm">
          Hidden: {{ hidden.length ? hidden.join(', ') : 'none' }}
        </z-text>
      </z-stack>
      <z-effect-scatter-chart
        heading="Regional Anomaly Detection Spikes (Interactive)"
        description="Animated ripple markers highlight peak error rates across primary and failover zones."
        xKey="window" [data]="data" [series]="series"
        [selectable]="true"
        [hiddenSeries]="hidden"
        (zSeriesToggle)="onToggle($event)"
        (zPointSelect)="onSelect($event)"
      ></z-effect-scatter-chart>
    </z-stack>
  `,
})
export class EffectScatterChartControlled {
  readonly data = anomalyData;
  readonly series = anomalySeries;
  hidden: string[] = [];
  selected = 'Click any chart element to inspect';

  onToggle(e: CustomEvent<ChartSeriesToggleDetail>) {
    this.hidden = e.detail.hiddenSeries;
  }

  onSelect(e: CustomEvent<ChartPointSelectDetail>) {
    this.selected = `Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`;
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZEffectScatterChart } from '@zelviora/angular-chart';
import { anomalyData, anomalySeries } from '../data';

@Component({
  selector: 'demo-effect-scatter-chart-customization',
  imports: [ZEffectScatterChart],
  template: `
    <z-effect-scatter-chart
      class="demo-chart-brand"
      description="Animated ripple markers highlight peak error rates across primary and failover zones."
      [valueFormat]="{ maximumFractionDigits: 1 }"
      xKey="window" [data]="data" [series]="series" [rippleScale]="3.5" tooltipMode="point" renderer="canvas"
    >
      <span slot="heading">Regional Anomaly Detection Spikes — Custom Theme Tokens &amp; Canvas</span>
    </z-effect-scatter-chart>
  `,
})
export class EffectScatterChartCustomization {
  readonly data = anomalyData;
  readonly series = anomalySeries;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZEffectScatterChart } from '@zelviora/angular-chart';
import { anomalyData, anomalySeries } from '../data';

@Component({
  selector: 'demo-effect-scatter-chart-states',
  imports: [ZStack, ZEffectScatterChart],
  template: `
    <z-stack gap="lg">
      <z-effect-scatter-chart
        heading="Loading State (aria-busy)"
        [loading]="true"
        xKey="window" [data]="data" [series]="series"
      ></z-effect-scatter-chart>
      <z-effect-scatter-chart
        heading="Empty State"
        [data]="[]"
        [series]="series"
      ></z-effect-scatter-chart>
      <z-effect-scatter-chart
        heading="Expanded Accessible Data Table"
        description="Animated ripple markers highlight peak error rates across primary and failover zones."
        [showDataTable]="true"
        xKey="window" [data]="data" [series]="series"
      ></z-effect-scatter-chart>
    </z-stack>
  `,
})
export class EffectScatterChartStates {
  readonly data = anomalyData;
  readonly series = anomalySeries;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZEffectScatterChart } from '@zelviora/angular-chart';
import { anomalyData, anomalySeries } from '../data';

@Component({
  selector: 'demo-effect-scatter-chart-variants',
  imports: [ZStack, ZEffectScatterChart],
  template: `
    <z-stack gap="lg">
      <z-effect-scatter-chart
        heading="Continuous Render Ripple"
        description="Continuous ripple animation on render vs hover-triggered emphasis ripple."
        xKey="window" [data]="data" [series]="series" showEffectOn="render" [rippleScale]="4" [symbolSize]="16"
      ></z-effect-scatter-chart>
      <z-effect-scatter-chart
        heading="Emphasis Hover Ripple"
        description="Continuous ripple animation on render vs hover-triggered emphasis ripple."
        xKey="window" [data]="data" [series]="series" showEffectOn="emphasis" [rippleScale]="2.5" [symbolSize]="12"
      ></z-effect-scatter-chart>
    </z-stack>
  `,
})
export class EffectScatterChartVariants {
  readonly data = anomalyData;
  readonly series = anomalySeries;
}

```


================================================================================
# COMPONENT: EMPTY-STATE
================================================================================

## Documentation

# empty-state — Angular

Processed requirements of [`<z-empty-state>`](../../../../../requirements/04-components/data-display/empty-state.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-empty-state heading="No orders" [headingLevel]="2">New orders show here.</z-empty-state>
```

## Binding

No model event. Search keyword: "Empty" (antd / shadcn `Empty`).

## Events

None.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `empty-state-basic.ts` | D-1 Default |
| `sizes` | `empty-state-sizes.ts` | D-5 Sizes |
| `no-results` | `empty-state-no-results.ts` | D-21 No results, D-15 Keyboard-only |
| `custom` | `empty-state-custom.ts` | D-18 Customization, D-17 Composition |


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZEmptyState } from '@zelviora/angular';

@Component({
  selector: 'demo-empty-state-basic',
  imports: [ZEmptyState],
  template: `
    <z-empty-state></z-empty-state>
  `,
})
export class EmptyStateBasic {}

```

### Case: custom

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZEmptyState } from '@zelviora/angular';

@Component({
  selector: 'demo-empty-state-custom',
  imports: [ZButton, ZEmptyState],
  template: `
    <z-empty-state [headingLevel]="3">
      <svg slot="image" viewBox="0 0 48 48" width="64" height="64" fill="none" stroke="currentColor" stroke-width="2">
        <rect x="8" y="10" width="32" height="28" rx="3" />
        <path d="M8 18h32M16 26h16M16 32h10" />
      </svg>
      <span slot="heading">No orders yet</span>
      New orders will appear here.
      <z-button slot="actions">Create order</z-button>
      <z-button slot="actions" variant="ghost" tone="neutral">Import from file</z-button>
    </z-empty-state>
  `,
})
export class EmptyStateCustom {}

```

### Case: no-results

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZEmptyState, ZInput, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-empty-state-no-results',
  imports: [ZButton, ZEmptyState, ZInput, ZStack],
  template: `
    <z-stack gap="md" class="demo-narrow">
      <z-input type="search" label="Search orders" [value]="query()" (zInput)="query.set($event.detail.value)"></z-input>
      <z-empty-state [heading]="query() ? 'No results for &quot;' + query() + '&quot;' : 'Type to search'" [headingLevel]="3">
        Check the spelling or try another keyword.
        <z-button slot="actions" variant="outline" tone="neutral" [disabled]="!query()" (click)="query.set('')">Clear search</z-button>
      </z-empty-state>
    </z-stack>
  `,
})
export class EmptyStateNoResults {
  readonly query = signal('abc');
}

```

### Case: sizes

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCard, ZEmptyState, ZGrid } from '@zelviora/angular';

@Component({
  selector: 'demo-empty-state-sizes',
  imports: [ZCard, ZEmptyState, ZGrid],
  template: `
    <z-grid columns="1 md:3" gap="md">
      @for (size of sizes; track size) {
        <z-card>
          <z-empty-state [size]="size" [heading]="'Size ' + size" description="No orders yet."></z-empty-state>
        </z-card>
      }
    </z-grid>
  `,
})
export class EmptyStateSizes {
  readonly sizes = ['sm', 'md', 'lg'] as const;
}

```


================================================================================
# COMPONENT: FIELD
================================================================================

## Documentation

# field — Angular

Processed requirements of [`<z-field>`](../../../../../requirements/04-components/form/field.md) for Angular (`@zelviora/angular`).

## Usage

```ts
import { Component } from '@angular/core';
import { ZField, ZInput } from '@zelviora/angular';

@Component({
  selector: 'app-email',
  imports: [ZField, ZInput],
  template: `
    <z-field label="Email" hint="Work email" [error]="error">
      <z-input name="email" type="email" [required]="true"></z-input>
    </z-field>
  `,
})
export class Email { error: string | null = null; }
```

Put exactly one control inside. Library controls receive the label, hint and error as text; a native `<input>` without a
name gets `aria-label`. The field never changes the control's `required` or validity: `required` on the field only shows
the mark, `error` only shows the message and marks the control invalid.

## Binding

No model event. `[error]` is a one-way input from app state (an Angular `FormControl` error message, server errors).

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `field-basic.ts` | D-1 Default |
| `error` | `field-error.ts` | D-8 Error (prop), D-9 Controlled |
| `horizontal` | `field-horizontal.ts` | D-3 Variants, D-6 optional |

Not yet covered: D-17 composition with select, checkbox and radio-group (other components), D-11 RTL.

## Differences

- Boolean and number props are bound with `[prop]="…"` (`[required]="true"`, `[maxLength]="20"`), so the value reaches the element with its type.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZField, ZInput } from '@zelviora/angular';

@Component({
  selector: 'demo-field-basic',
  imports: [ZField, ZInput],
  template: `
    <div class="demo-narrow">
      <z-field label="Email" hint="Use your work email" [required]="true">
        <z-input name="email" type="email" [required]="true"></z-input>
      </z-field>
    </div>
  `,
})
export class FieldBasic {}

```

### Case: error

#### Angular
```typescript
import { Component, computed, signal } from '@angular/core';
import { ZField, ZInput } from '@zelviora/angular';

const taken = ['admin', 'root'];

@Component({
  selector: 'demo-field-error',
  imports: [ZField, ZInput],
  template: `
    <div class="demo-narrow">
      <z-field label="Username" hint="3 to 20 letters" [error]="error()">
        <z-input name="username" [value]="name()" (zInput)="name.set($event.detail.value)"></z-input>
      </z-field>
    </div>
  `,
})
export class FieldError {
  readonly name = signal('admin');
  readonly error = computed(() => (taken.includes(this.name().trim().toLowerCase()) ? 'This username is already taken.' : null));
}

```

### Case: horizontal

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZField, ZInput, ZStack, ZTextarea } from '@zelviora/angular';

@Component({
  selector: 'demo-field-horizontal',
  imports: [ZField, ZInput, ZStack, ZTextarea],
  template: `
    <z-stack>
      <z-field label="Full name" orientation="horizontal" [required]="true">
        <z-input name="name" [required]="true"></z-input>
      </z-field>
      <z-field label="Company" orientation="horizontal" [showOptional]="true">
        <z-input name="company"></z-input>
      </z-field>
      <z-field label="About you" orientation="horizontal" hint="A few words for your profile">
        <z-textarea name="about" [rows]="2"></z-textarea>
      </z-field>
    </z-stack>
  `,
})
export class FieldHorizontal {}

```


================================================================================
# COMPONENT: FILE-UPLOAD
================================================================================

## Documentation

# file-upload — Angular

Processed requirements of [`<z-file-upload>`](../../../../../requirements/04-components/form/file-upload.md) for Angular
(`@zelviora/angular`, standalone components, Angular 18–21).

## Usage

```ts
import { Component } from '@angular/core';
import { FormControl, ReactiveFormsModule } from '@angular/forms';
import type { ZUploadFile } from '@zelviora/core';
import { FORM_DIRECTIVES, ZFileUpload } from '@zelviora/angular';

@Component({
  selector: 'app-attachments',
  imports: [ReactiveFormsModule, ZFileUpload, ...FORM_DIRECTIVES],
  template: `<z-file-upload name="attachments" label="Attachments" [multiple]="true" [formControl]="files"></z-file-upload>`,
})
export class Attachments { readonly files = new FormControl<ZUploadFile[]>([], { nonNullable: true }); }
```

## Binding

| Component | Value accessor | Model | Event | Detail |
|---|---|---|---|---|
| `ZFileUpload` | `FileUploadValueAccessor` (included in `FORM_DIRECTIVES`) | `files` (`ZUploadFile[]`) | `(zChange)` | `{ files, reason: 'add' \| 'remove' \| 'status' }` |

`FileUploadValueAccessor` (exported directly and included in `FORM_DIRECTIVES` / `ZELVIORA_FORM_DIRECTIVES`) bridges `[(ngModel)]`, `[formControl]`, and `formControlName` to `[files]` and `(zChange)` while forwarding native constraint validity (`required`, `maxSize`, `maxCount`, custom `validate`) via `ValidityValidator`. You can also bind `[files]` + `(zChange)` directly without `ReactiveFormsModule`.
`[uploadRequest]`, `[beforeUpload]`, and `[validate]` take functions. The library never calls the network.

## Events

`(zChange)`, `(zBeforeAdd)` (cancelable), `(zRemove)` (cancelable), `(zError)` (`reason: 'reject' | 'upload'`).

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `file-upload-default.ts` | D-1 Default, D-15 Keyboard-only |
| `variants` | `file-upload-variants.ts` | D-3 Variants (text / picture / card, hide-dropzone) |
| `states` | `file-upload-states.ts` | D-6 States, D-7 Disabled, D-8 Error (size rejection, required) |
| `controlled` | `file-upload-controlled.ts` | D-9 Controlled |
| `form` | `file-upload-form.ts` | D-10 In form, D-17 Composition (field) |
| `upload` | `file-upload-upload.ts` | D-21 Upload function, D-23 Manual upload |
| `avatar` | `file-upload-avatar.ts` | D-24 Avatar |
| `i18n` | `file-upload-i18n.ts` | D-19 i18n (vi texts and sizes) |

## Security

Client-side checks (`accept`, `maxSize` / `minSize`, `maxCount`, `validate`) are a convenience for the user, **not a
security control**: anyone can change the request or the DOM (FILE-UPLOAD-GAP-002, SEC-4). Your server must:

- validate again the file type from its content (magic bytes, never the extension or the browser-reported MIME type),
  the size and the count;
- store files under a generated name (never the original name as a path) and scan them when your business needs it;
- serve uploaded files back with `Content-Disposition: attachment` for SVG / HTML / XML, the real `Content-Type` and
  `X-Content-Type-Options: nosniff`, ideally from a separate domain.

File names are untrusted text: the component shows them as text; escape them wherever your app shows them.

## Differences

- `FileUploadValueAccessor` (in `FORM_DIRECTIVES`) binds `ZUploadFile[]` to Angular Reactive and Template-driven forms; methods (`upload()`, `abort(id?)`, `open()`, `reset()`, `markAsPristine()`) are called on the element (`viewChild(…, { read: ElementRef })`).
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: avatar

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZFileUpload, ZStack } from '@zelviora/angular';

const MAX = 2 * 1024 * 1024;

/** Avatar: one image as a card; zBeforeAdd cancels images over 2 MB (the app shows its own message). */
@Component({
  selector: 'demo-file-upload-avatar',
  imports: [ZFileUpload, ZStack],
  template: `
    <z-stack gap="sm">
      <z-file-upload label="Avatar" listType="card" [maxCount]="1" accept="image/*" (zBeforeAdd)="beforeAdd($event)"></z-file-upload>
      @if (message()) {
        <span class="demo-text-destructive">{{ message() }}</span>
      }
    </z-stack>
  `,
})
export class FileUploadAvatar {
  readonly message = signal('');

  beforeAdd(e: CustomEvent<{ files: File[] }>) {
    const big = e.detail.files.find((f) => f.size > MAX);
    this.message.set(big ? `${big.name} is larger than 2 MB` : '');
    if (big) e.preventDefault();
  }
}

```

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import type { ZFileUploadChangeDetail, ZFileUploadErrorDetail, ZUploadFile } from '@zelviora/core';
import { ZButton, ZFileUpload, ZStack } from '@zelviora/angular';

/**
 * `[files]` + `(zChange)`: the model is an array of objects, so there is no ngModel value accessor for this component
 * (C-form-file-upload §12); the signal is updated from the event detail, which also reports the reason.
 */
@Component({
  selector: 'demo-file-upload-controlled',
  imports: [ZButton, ZFileUpload, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-file-upload label="Documents" [multiple]="true" [maxCount]="3" [files]="files()" (zChange)="onChange($event.detail)" (zError)="onError($event.detail)"></z-file-upload>
      <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
        <z-button variant="outline" tone="neutral" (click)="files.set([])">Clear from state</z-button>
        <span>{{ files().length }} file(s)</span>
      </z-stack>
      <ul>
        @for (l of log(); track $index) {
          <li>{{ l }}</li>
        }
      </ul>
    </z-stack>
  `,
})
export class FileUploadControlled {
  readonly files = signal<ZUploadFile[]>([]);
  readonly log = signal<string[]>([]);

  onChange(detail: ZFileUploadChangeDetail) {
    this.files.set(detail.files);
    this.log.update((l) => [...l, `${detail.reason}: ${detail.files.map((f) => f.name).join(', ') || '(empty)'}`]);
  }

  onError(detail: ZFileUploadErrorDetail) {
    const err = detail.error;
    if (err.reason === 'reject') this.log.update((l) => [...l, `rejected: ${err.rejections.map((r) => `${r.name} (${r.errors.join(', ')})`).join(', ')}`]);
  }
}

```

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZFileUpload, ZStack } from '@zelviora/angular';

/** One file, chosen with the button (keyboard path) or dropped on the zone; sizes follow the locale. */
@Component({
  selector: 'demo-file-upload-default',
  imports: [ZFileUpload, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-file-upload name="attachment" label="Attachment" accept=".pdf,image/*" [maxSize]="tenMb" hint="Tab to the button, then Enter or Space opens the file picker."></z-file-upload>
      <z-file-upload name="contract" label="Contract" accept=".pdf" [maxSize]="fiveMb" [multiple]="true"></z-file-upload>
    </z-stack>
  `,
})
export class FileUploadDefault {
  readonly tenMb = 10 * 1024 * 1024;
  readonly fiveMb = 5 * 1024 * 1024;
}

```

### Case: finder

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZFileUpload, ZGrid } from '@zelviora/angular';

const svgThumb = (bg1: string, bg2: string, label: string) =>
  `data:image/svg+xml;utf8,${encodeURIComponent(
    `<svg xmlns="http://www.w3.org/2000/svg" width="320" height="200" viewBox="0 0 320 200"><defs><linearGradient id="g" x1="0" y1="0" x2="1" y2="1"><stop offset="0%" stop-color="${bg1}"/><stop offset="100%" stop-color="${bg2}"/></linearGradient></defs><rect width="320" height="200" rx="16" fill="url(#g)"/><text x="50%" y="54%" dominant-baseline="middle" text-anchor="middle" fill="#ffffff" font-family="system-ui,sans-serif" font-size="22" font-weight="600">${label}</text></svg>`,
  )}`;

const SHARED_FINDER_ITEMS = [
  { id: 'dir-brand', name: 'Brand Assets', type: 'folder' as const, parentId: null, updatedAt: '2026-04-10' },
  { id: 'dir-docs', name: 'Project Docs', type: 'folder' as const, parentId: null, updatedAt: '2026-04-11' },
  {
    id: 'img-hero',
    name: 'hero-banner.png',
    type: 'file' as const,
    size: 428_500,
    mimeType: 'image/png',
    dimensions: '1920 x 1080',
    parentId: null,
    updatedAt: '2026-04-12',
    thumbnail: svgThumb('#2563eb', '#7c3aed', 'Hero Banner'),
  },
  {
    id: 'img-cover',
    name: 'product-cover.webp',
    type: 'file' as const,
    size: 312_800,
    mimeType: 'image/webp',
    dimensions: '1600 x 1200',
    parentId: null,
    updatedAt: '2026-04-14',
    thumbnail: svgThumb('#059669', '#0ea5e9', 'Product Cover'),
  },
  {
    id: 'doc-spec',
    name: 'architecture-spec.pdf',
    type: 'file' as const,
    size: 1_245_000,
    mimeType: 'application/pdf',
    parentId: null,
    updatedAt: '2026-04-13',
  },
  {
    id: 'doc-budget',
    name: 'quarterly-report.csv',
    type: 'file' as const,
    size: 84_300,
    mimeType: 'text/csv',
    parentId: null,
    updatedAt: '2026-04-15',
  },
  {
    id: 'arc-release',
    name: 'release-bundle.zip',
    type: 'file' as const,
    size: 3_480_000,
    mimeType: 'application/zip',
    parentId: null,
    updatedAt: '2026-04-16',
  },
];

@Component({
  selector: 'demo-file-upload-finder',
  imports: [ZFileUpload, ZGrid],
  template: `
    <z-grid columns="1 md:2" gap="lg">
      <z-file-upload
        [finder]="true"
        [finderConfig]="imageFinderConfig"
        label="Product images (Finder — images only)"
        accept="image/*"
        listType="picture"
        [multiple]="true"
        [maxSize]="tenMb"
        hint="Opens Finder filtered by accept='image/*': only PNG/WebP images are shown even though Finder also contains PDF, CSV, and ZIP files."
      ></z-file-upload>
      <z-file-upload
        [finder]="true"
        [finderConfig]="documentFinderConfig"
        label="Attachments (Finder — PDF & CSV only)"
        accept=".pdf,.csv"
        [multiple]="true"
        [maxSize]="tenMb"
        hint="Opens Finder in list mode filtered by accept='.pdf,.csv': only PDF and CSV documents are visible."
      ></z-file-upload>
    </z-grid>
  `,
})
export class FileUploadFinder {
  readonly tenMb = 10 * 1024 * 1024;
  readonly imageFinderConfig = {
    heading: 'Select images from Finder',
    items: SHARED_FINDER_ITEMS,
    viewMode: 'grid' as const,
    maxFileSize: this.tenMb,
  };
  readonly documentFinderConfig = {
    heading: 'Select documents (.pdf, .csv) from Finder',
    items: SHARED_FINDER_ITEMS,
    viewMode: 'list' as const,
    maxFileSize: this.tenMb,
  };
}

```

### Case: form

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZField, ZFileUpload, ZStack } from '@zelviora/angular';

/**
 * Native form without uploadRequest: each File is a FormData entry under the name; required in a field; reset.
 * FormsModule is not imported, so the form stays native and the element submits its own FormData entries.
 */
@Component({
  selector: 'demo-file-upload-form',
  imports: [ZButton, ZField, ZFileUpload, ZStack],
  template: `
    <form class="demo-narrow" (submit)="submit($event)">
      <z-stack>
        <z-field label="CV" hint="PDF, up to 2 MB" [required]="true">
          <z-file-upload name="cv" accept=".pdf" [maxSize]="twoMb" [required]="true"></z-file-upload>
        </z-field>
        <z-file-upload name="certificates" label="Certificates" [multiple]="true"></z-file-upload>
        <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
          <z-button type="submit">Submit</z-button>
          <z-button type="reset" variant="outline" tone="neutral">Reset</z-button>
        </z-stack>
        @if (sent()) {
          <output>{{ sent() }}</output>
        }
      </z-stack>
    </form>
  `,
})
export class FileUploadForm {
  readonly sent = signal('');
  readonly twoMb = 2 * 1024 * 1024;

  submit(e: Event) {
    e.preventDefault();
    const entries = [...new FormData(e.currentTarget as HTMLFormElement).entries()].map(([k, v]) => [k, typeof v === 'string' ? v : `File(${v.name})`]);
    this.sent.set(JSON.stringify(entries));
  }
}

```

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZFileUpload, ZStack } from '@zelviora/angular';

/** `lang="vi"`: built-in texts and sizes follow the Vietnamese locale. */
@Component({
  selector: 'demo-file-upload-i18n',
  imports: [ZFileUpload, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-file-upload lang="vi" name="hop-dong" label="Hợp đồng" accept=".pdf" [maxSize]="fiveMb" [multiple]="true"></z-file-upload>
    </z-stack>
  `,
})
export class FileUploadI18n {
  readonly fiveMb = 5 * 1024 * 1024;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import type { ZUploadFile } from '@zelviora/core';
import { ZFileUpload, ZGrid } from '@zelviora/angular';

/** Uploading, done, upload error, disabled, read-only, required/invalid and a size rejection (max 1 KB). */
@Component({
  selector: 'demo-file-upload-states',
  imports: [ZFileUpload, ZGrid],
  template: `
    <z-grid columns="1 md:2" gap="lg">
      <z-file-upload label="Uploading" [defaultFiles]="uploading"></z-file-upload>
      <z-file-upload label="Done" [defaultFiles]="done"></z-file-upload>
      <z-file-upload label="Upload error" [defaultFiles]="failed"></z-file-upload>
      <z-file-upload label="Disabled" [disabled]="true" [defaultFiles]="done"></z-file-upload>
      <z-file-upload label="Read-only" [readonly]="true" [defaultFiles]="done"></z-file-upload>
      <z-file-upload label="Invalid" [required]="true" [invalid]="true" hint="Required: choose a file."></z-file-upload>
      <z-file-upload label="Max 1 KB" [maxSize]="1024" hint="Choose a larger file to see the rejection message."></z-file-upload>
    </z-grid>
  `,
})
export class FileUploadStates {
  readonly uploading: ZUploadFile[] = [{ id: 'u1', name: 'video-gioi-thieu.mp4', size: 48_000_000, type: 'video/mp4', status: 'uploading', progress: 0.6 }];
  readonly done: ZUploadFile[] = [{ id: 'd1', name: 'hop-dong.pdf', size: 1_258_291, type: 'application/pdf', status: 'done', progress: 1 }];
  readonly failed: ZUploadFile[] = [{ id: 'e1', name: 'bang-luong.xlsx', size: 92_000, type: '', status: 'error', progress: 0, error: 'Server error' }];
}

```

### Case: upload

#### Angular
```typescript
import { Component, ElementRef, viewChild } from '@angular/core';
import type { ZFileUploadRequest } from '@zelviora/core';
import { ZButton, ZFileUpload, ZStack } from '@zelviora/angular';

let uploads = 0;

/** Simulated upload (no network): progress every 200 ms; every third upload fails so the retry button shows. */
const fakeUpload: ZFileUploadRequest = (file, { signal, onProgress }) =>
  new Promise((resolve, reject) => {
    const fail = ++uploads % 3 === 0;
    let progress = 0;
    const timer = setInterval(() => {
      progress = Math.min(1, progress + 0.25);
      onProgress(progress);
      if (progress < 1) return;
      clearInterval(timer);
      if (fail) reject(new Error('Server error'));
      else resolve(`files/${file.name}`);
    }, 200);
    signal.addEventListener('abort', () => {
      clearInterval(timer);
      reject(signal.reason);
    });
  });

/** uploadRequest uploads at once; with manualUpload files wait until upload() is called. */
@Component({
  selector: 'demo-file-upload-upload',
  imports: [ZButton, ZFileUpload, ZStack],
  template: `
    <z-stack class="demo-narrow" gap="lg">
      <z-file-upload label="Upload function" [multiple]="true" [uploadRequest]="upload" hint="Every third file fails: use the retry button."></z-file-upload>
      <z-stack gap="sm">
        <z-file-upload #manual label="Manual upload" [multiple]="true" [manualUpload]="true" [uploadRequest]="upload"></z-file-upload>
        <z-button (click)="uploadAll()">Upload all</z-button>
      </z-stack>
    </z-stack>
  `,
})
export class FileUploadUpload {
  readonly upload = fakeUpload;
  private readonly manual = viewChild.required('manual', { read: ElementRef });

  uploadAll() {
    void (this.manual().nativeElement as HTMLElement & { upload(id?: string): Promise<void> }).upload();
  }
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import type { ZUploadFile } from '@zelviora/core';
import { ZFileUpload, ZGrid } from '@zelviora/angular';

/** List types: rows, rows with thumbnails, a grid of cards; and a button without a drop zone. */
@Component({
  selector: 'demo-file-upload-variants',
  imports: [ZFileUpload, ZGrid],
  template: `
    <z-grid columns="1 md:2" gap="lg">
      <z-file-upload label="Text (default)" [multiple]="true" [defaultFiles]="existing"></z-file-upload>
      <z-file-upload label="Picture" listType="picture" accept="image/*" [multiple]="true" [defaultFiles]="existing"></z-file-upload>
      <z-file-upload label="Card" listType="card" accept="image/*" [multiple]="true" [maxCount]="4" [defaultFiles]="existing"></z-file-upload>
      <z-file-upload label="Button only" [hideDropzone]="true" [multiple]="true" [defaultFiles]="existing"></z-file-upload>
    </z-grid>
  `,
})
export class FileUploadVariants {
  // Files already on the server (no `file`): shown, not submitted again.
  readonly existing: ZUploadFile[] = [
    { id: 'srv-1', name: 'bao-cao-quy-3.pdf', size: 482_000, type: 'application/pdf', status: 'done', progress: 1 },
    { id: 'srv-2', name: 'so-do-mat-bang.png', size: 1_240_000, type: 'image/png', status: 'done', progress: 1 },
  ];
}

```


================================================================================
# COMPONENT: FINDER
================================================================================

## Documentation

# Finder

Interactive file and media manager (`<z-finder>`) supporting hierarchical folder navigation, grid and list layouts, type filtering, search, sorting, drag-and-drop file uploads, metadata inspection, inline rename/delete/new-folder dialogs, and both inline page and modal dialog picker modes.

## Features

- **Dual Presentation Modes**: Render inline as a full workspace (`display-mode="page"`) or as a top-layer modal asset picker (`display-mode="dialog"`).
- **Declarative & Async Storage**: Pass a flat or nested `items` array for client-side state, or supply an async `config` adapter (`list`, `createFolder`, `upload`, `update`, `delete`, `download`) for backends such as Directus, S3, or custom REST APIs.
- **Grid & List Views**: Switch seamlessly between visual thumbnail/icon cards and sortable metadata rows.
- **Accessible by Default**: WAI-ARIA `tree`, `listbox`, `dialog`, roving focus, keyboard shortcuts (`Arrow` keys, `Enter`, `Backspace`, `F2`, `Delete`, `Ctrl/Cmd+A`, `Escape`), and screen-reader live announcements.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZFinder, ZStack, ZTag, ZText, type ZFinderItem } from '@zelviora/angular';

@Component({
  selector: 'demo-finder-basic',
  imports: [ZFinder, ZStack, ZTag, ZText],
  template: `
    <z-stack gap="md">
      <z-finder
        class="demo-finder-frame"
        heading="Media Library"
        [items]="items"
        [multiple]="true"
        (zSelect)="onSelect($event)"
      ></z-finder>
      @if (confirmed().length > 0) {
        <z-stack orientation="horizontal" align-items="center" gap="sm" [wrap]="true">
          <z-text size="sm" variant="muted">Confirmed:</z-text>
          @for (item of confirmed(); track item.id) {
            <z-tag>{{ item.name }}</z-tag>
          }
        </z-stack>
      }
    </z-stack>
  `,
})
export class FinderBasic {
  readonly items: ZFinderItem[] = [
    { id: 'dir-brand', name: 'Brand Assets', type: 'folder', parentId: null, updatedAt: '2026-04-10' },
    { id: 'dir-docs', name: 'Specifications', type: 'folder', parentId: null, updatedAt: '2026-04-12' },
    { id: 'dir-logos', name: 'Vector Logos', type: 'folder', parentId: 'dir-brand', updatedAt: '2026-04-11' },
    {
      id: 'file-wordmark',
      name: 'wordmark-primary.svg',
      type: 'file',
      size: 48_200,
      mimeType: 'image/svg+xml',
      dimensions: '1200 x 320',
      parentId: 'dir-logos',
      updatedAt: '2026-04-11',
    },
    {
      id: 'file-hero',
      name: 'campaign-hero.png',
      type: 'file',
      size: 2_450_000,
      mimeType: 'image/png',
      dimensions: '2560 x 1440',
      parentId: null,
      updatedAt: '2026-04-15',
    },
    {
      id: 'file-guide',
      name: 'design-system-guide.pdf',
      type: 'file',
      size: 4_120_000,
      mimeType: 'application/pdf',
      parentId: 'dir-docs',
      updatedAt: '2026-04-16',
    },
    {
      id: 'file-metrics',
      name: 'q2-usage-report.csv',
      type: 'file',
      size: 128_500,
      mimeType: 'text/csv',
      parentId: null,
      updatedAt: '2026-04-18',
    },
  ];

  readonly confirmed = signal<ZFinderItem[]>([]);

  onSelect(e: CustomEvent<{ items: ZFinderItem[] }>) {
    this.confirmed.set(e.detail.items);
  }
}

```

### Case: config

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZFinder, ZStack, type ZFinderConfig, type ZFinderItem } from '@zelviora/angular';

@Component({
  selector: 'demo-finder-config',
  imports: [ZFinder, ZStack],
  template: `
    <z-stack>
      <z-finder class="demo-finder-frame" heading="Cloud Storage" [config]="config" [multiple]="true"></z-finder>
    </z-stack>
  `,
})
export class FinderConfig {
  private store: ZFinderItem[] = [
    { id: 'cloud-contracts', name: 'Contracts', type: 'folder', parentId: null, updatedAt: '2026-04-01' },
    {
      id: 'cloud-msa',
      name: 'master-service-agreement.pdf',
      type: 'file',
      size: 940_000,
      mimeType: 'application/pdf',
      parentId: 'cloud-contracts',
      updatedAt: '2026-04-04',
    },
    {
      id: 'cloud-banner',
      name: 'partner-spotlight.png',
      type: 'file',
      size: 1_120_000,
      mimeType: 'image/png',
      dimensions: '1440 x 900',
      parentId: null,
      updatedAt: '2026-04-14',
    },
  ];

  readonly config: ZFinderConfig = {
    defaultViewMode: 'list',
    maxFileSize: 5 * 1024 * 1024,
    allowedTypes: ['image/*', '.pdf', '.csv'],
    list: async (folderId) => this.store.filter((entry) => (entry.parentId ?? null) === (folderId ?? null)),
    createFolder: async (name, parentId) => {
      const folder: ZFinderItem = {
        id: `folder-${Date.now()}`,
        name,
        type: 'folder',
        parentId,
        updatedAt: new Date().toISOString(),
      };
      this.store = [...this.store, folder];
      return folder;
    },
    upload: async (file, folderId) => {
      const uploaded: ZFinderItem = {
        id: `file-${Date.now()}-${file.name}`,
        name: file.name,
        type: 'file',
        size: file.size,
        mimeType: file.type || 'application/octet-stream',
        parentId: folderId,
        updatedAt: new Date().toISOString(),
      };
      this.store = [...this.store, uploaded];
      return uploaded;
    },
    update: async (id, patch) => {
      let updatedEntry: ZFinderItem | undefined;
      this.store = this.store.map((entry) => {
        if (entry.id !== id) return entry;
        updatedEntry = { ...entry, ...patch, updatedAt: new Date().toISOString() };
        return updatedEntry;
      });
      return updatedEntry!;
    },
    delete: async (id) => {
      this.store = this.store.filter((entry) => entry.id !== id && entry.parentId !== id);
    },
  };
}

```

### Case: dialog

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZFinder, ZStack, ZTag, ZText, dialogService, type ZFinderItem } from '@zelviora/angular';

@Component({
  selector: 'demo-finder-dialog',
  imports: [ZButton, ZFinder, ZStack, ZTag, ZText],
  template: `
    <z-stack gap="sm" align-items="start">
      <z-stack orientation="horizontal" gap="xs" wrap="wrap">
        <z-button variant="solid" (click)="openViaService()">Browse via DialogService</z-button>
        <z-button variant="outline" tone="neutral" (click)="open.set(true)">Browse Declarative Modal</z-button>
      </z-stack>

      <z-finder
        displayMode="dialog"
        heading="Select Assets"
        [open]="open()"
        [multiple]="true"
        [items]="items"
        (zOpenChange)="open.set($event.detail.open)"
        (zSelect)="picked.set($event.detail.items)"
      ></z-finder>

      @if (picked().length > 0) {
        <z-stack orientation="horizontal" align-items="center" gap="xs" wrap="wrap">
          <z-text size="sm" variant="muted">Selected:</z-text>
          @for (item of picked(); track item.id) {
            <z-tag>{{ item.name }}</z-tag>
          }
        </z-stack>
      } @else {
        <z-text size="sm" variant="muted">No assets selected yet.</z-text>
      }
    </z-stack>
  `,
})
export class FinderDialog {
  readonly open = signal(false);
  readonly picked = signal<ZFinderItem[]>([]);

  readonly items: ZFinderItem[] = [
    { id: 'folder-photos', name: 'Product Photos', type: 'folder', parentId: null, updatedAt: '2026-04-02' },
    {
      id: 'photo-front',
      name: 'device-front.webp',
      type: 'file',
      size: 890_000,
      mimeType: 'image/webp',
      dimensions: '1600 x 1200',
      parentId: 'folder-photos',
      updatedAt: '2026-04-05',
    },
    {
      id: 'photo-cover',
      name: 'release-cover.png',
      type: 'file',
      size: 1_560_000,
      mimeType: 'image/png',
      dimensions: '1920 x 1080',
      parentId: null,
      updatedAt: '2026-04-09',
    },
    {
      id: 'doc-press',
      name: 'press-kit.zip',
      type: 'file',
      size: 8_400_000,
      mimeType: 'application/zip',
      parentId: null,
      updatedAt: '2026-04-12',
    },
  ];

  async openViaService() {
    const ref = dialogService.openFinder({
      heading: 'Select Assets',
      multiple: true,
      items: this.items,
    });
    const result = await ref.afterClosed;
    if (result) {
      this.picked.set(result.items);
    }
  }
}

```

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZFinder, ZStack, type ZFinderItem } from '@zelviora/angular';

@Component({
  selector: 'demo-finder-i18n',
  imports: [ZFinder, ZStack],
  template: `
    <z-stack>
      <z-finder class="demo-finder-frame" lang="vi" [items]="duLieu" [multiple]="true"></z-finder>
    </z-stack>
  `,
})
export class FinderI18n {
  readonly duLieu: ZFinderItem[] = [
    { id: 'tm-tai-lieu', name: 'Hồ sơ pháp lý', type: 'folder', parentId: null, updatedAt: '2026-04-10' },
    { id: 'tm-hinh-anh', name: 'Thư viện ảnh', type: 'folder', parentId: null, updatedAt: '2026-04-12' },
    {
      id: 'tep-hop-dong',
      name: 'hop-dong-dich-vu-2026.pdf',
      type: 'file',
      size: 1_840_000,
      mimeType: 'application/pdf',
      parentId: 'tm-tai-lieu',
      updatedAt: '2026-04-14',
    },
    {
      id: 'tep-banner',
      name: 'anh-bia-trang-chu.png',
      type: 'file',
      size: 2_150_000,
      mimeType: 'image/png',
      dimensions: '1920 x 1080',
      parentId: null,
      updatedAt: '2026-04-18',
    },
  ];
}

```


================================================================================
# COMPONENT: FLOAT-BUTTON
================================================================================

## Documentation

# float-button — Angular

Processed requirements of [`<z-float-button>`](../../../../../requirements/04-components/navigation/float-button.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-float-button label="Chat"><chat-icon slot="icon"></chat-icon></z-float-button>
```

## Binding

Group: `[open]` + `(zOpenChange)` (no two-way binding for `open`, D-031).

## Events

| Event | Detail | Notes |
|---|---|---|
| `zOpenChange (group)` | `{ open, reason: 'trigger' | 'hover' | 'escape' | 'outside' | 'focus-out' }` | Not cancelable; not emitted when `open` is set by code |

## Notes

- Fixed or sticky content must not hide the focused element (FO-2): give the page `scroll-padding-top` / `scroll-padding-bottom` equal to its size (the library does not set it).
- The demos put fixed components in `demo-fixed-frame` (`contain: layout`) so they stay inside the preview.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `float-button-basic.ts` | D-1 Default |
| `variants` | `float-button-variants.ts` | D-3 Variants, D-4 Tones, D-14 Long content |
| `group` | `float-button-group.ts` | D-17 Composition |
| `placement` | `float-button-placement.ts` | D-17 placement, K-3 hover |
| `controlled` | `float-button-controlled.ts` | D-9 Controlled |


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZFloatButton, ZIcon } from '@zelviora/angular';

@Component({
  selector: 'demo-float-button-basic',
  imports: [ZFloatButton, ZIcon],
  template: `
    <div class="demo-fixed-frame">
      <z-float-button label="New message"><z-icon slot="icon" name="mail"></z-icon></z-float-button>
    </div>
  `,
})
export class FloatButtonBasic {}

```

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZFloatButton, ZFloatButtonGroup, ZIcon, ZStack, ZText } from '@zelviora/angular';

@Component({
  selector: 'demo-float-button-controlled',
  imports: [ZButton, ZFloatButton, ZFloatButtonGroup, ZIcon, ZStack, ZText],
  template: `
    <z-stack gap="md" align-items="start">
      <z-stack orientation="horizontal" gap="sm" align-items="center">
        <z-button variant="outline" tone="neutral" (click)="open.set(!open())">{{ open() ? 'Close' : 'Open' }} from code</z-button>
        <z-text>Last reason: {{ reason() }}</z-text>
      </z-stack>
      <div class="demo-fixed-frame">
        <z-float-button-group label="Quick actions" [open]="open()" (zOpenChange)="open.set($event.detail.open); reason.set($event.detail.reason)">
          <z-float-button label="Chat"><z-icon slot="icon" name="chat"></z-icon></z-float-button>
          <z-float-button label="Help" variant="soft"><z-icon slot="icon" name="help"></z-icon></z-float-button>
        </z-float-button-group>
      </div>
    </z-stack>
  `,
})
export class FloatButtonControlled {
  readonly open = signal(false);
  readonly reason = signal('none');
}

```

### Case: group

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZFloatButton, ZFloatButtonGroup, ZIcon } from '@zelviora/angular';

@Component({
  selector: 'demo-float-button-group',
  imports: [ZFloatButton, ZFloatButtonGroup, ZIcon],
  template: `
    <div class="demo-fixed-frame">
      <z-float-button-group label="Quick actions">
        <z-float-button label="Chat"><z-icon slot="icon" name="chat"></z-icon></z-float-button>
        <z-float-button label="Help" variant="soft"><z-icon slot="icon" name="help"></z-icon></z-float-button>
      </z-float-button-group>
    </div>
  `,
})
export class FloatButtonGroup {}

```

### Case: placement

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZFloatButton, ZFloatButtonGroup, ZIcon } from '@zelviora/angular';

@Component({
  selector: 'demo-float-button-placement',
  imports: [ZFloatButton, ZFloatButtonGroup, ZIcon],
  template: `
    <div class="demo-fixed-frame">
      <z-float-button-group label="Share" placement="start" trigger="hover">
        <z-float-button label="Copy link"><z-icon slot="icon" name="content_copy"></z-icon></z-float-button>
        <z-float-button label="Email"><z-icon slot="icon" name="mail"></z-icon></z-float-button>
      </z-float-button-group>
    </div>
  `,
})
export class FloatButtonPlacement {}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZFloatButton, ZIcon } from '@zelviora/angular';

@Component({
  selector: 'demo-float-button-variants',
  imports: [ZBadge, ZFloatButton, ZIcon],
  template: `
    <div class="demo-fixed-frame">
      <z-float-button shape="square" label="Feedback" position="start"><z-icon slot="icon" name="feedback"></z-icon></z-float-button>
      <z-float-button label="Notifications" variant="soft" tone="neutral"><z-icon slot="icon" name="notifications"></z-icon><z-badge slot="badge" tone="destructive">3</z-badge></z-float-button>
    </div>
  `,
})
export class FloatButtonVariants {}

```


================================================================================
# COMPONENT: FLOW
================================================================================

## Documentation

# Flow Angular Demos

Demo cases for `<z-flow>` in Angular.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZFlow } from '@zelviora/angular';
import type { FlowEdge, FlowNode } from '@zelviora/core';

@Component({
  selector: 'demo-flow-basic',
  imports: [ZFlow],
  template: `
    <div class="demo-flow-canvas">
      <z-flow
        [nodes]="nodes"
        [edges]="edges()"
        [padding]="40"
        (zConnect)="onConnect($event)"
      ></z-flow>
    </div>
  `,
})
export class FlowBasic {
  readonly nodes: FlowNode[] = [
    {
      id: 'input-node',
      position: { x: 40, y: 80 },
      data: { label: 'Data Source' },
      inputs: [],
      outputs: ['right', 'bottom'],
    },
    {
      id: 'process-node',
      position: { x: 260, y: 80 },
      data: { label: 'Transformation Engine' },
      inputs: ['left'],
      outputs: ['right'],
    },
    {
      id: 'output-node',
      position: { x: 500, y: 80 },
      data: { label: 'Dashboard Output' },
      inputs: ['left'],
      outputs: [],
    },
  ];

  readonly edges = signal<FlowEdge[]>([
    {
      id: 'edge-1',
      source: 'input-node',
      target: 'process-node',
      type: 'smoothstep',
      variant: 'solid',
    },
    {
      id: 'edge-2',
      source: 'process-node',
      target: 'output-node',
      type: 'smoothstep',
      variant: 'solid',
    },
  ]);

  onConnect(e: CustomEvent<{ source: string; target: string; sourceHandle?: any; targetHandle?: any }>) {
    const { source, target, sourceHandle, targetHandle } = e.detail;
    this.edges.update((prev) => [
      ...prev,
      {
        id: `edge-${Date.now()}`,
        source,
        target,
        sourceHandle,
        targetHandle,
        type: 'smoothstep',
        variant: 'solid',
      },
    ]);
  }
}

```

### Case: interactive

#### Angular
```typescript
import { Component, computed, signal } from '@angular/core';
import { ZFlow, ZButton, ZStack, ZText } from '@zelviora/angular';
import type { FlowEdge, FlowNode } from '@zelviora/core';

@Component({
  selector: 'demo-flow-interactive',
  imports: [ZFlow, ZButton, ZStack, ZText],
  template: `
    <z-stack gap="sm">
      <z-stack orientation="horizontal" gap="xs" align-items="center">
        <z-text variant="muted" size="sm">Zoom:</z-text>
        <z-button size="sm" (click)="zoomOut()">-</z-button>
        <span class="demo-flow-zoom-label">{{ zoomPercent() }}%</span>
        <z-button size="sm" (click)="zoomIn()">+</z-button>
        <z-button size="sm" variant="outline" (click)="resetZoom()">Reset</z-button>
      </z-stack>

      <div class="demo-flow-canvas-interactive">
        <z-flow
          [nodes]="nodes"
          [edges]="edges"
          [zoom]="zoom()"
          [padding]="50"
        ></z-flow>
      </div>
    </z-stack>
  `,
})
export class FlowInteractive {
  readonly zoom = signal(1);
  readonly zoomPercent = computed(() => Math.round(this.zoom() * 100));

  readonly nodes: FlowNode[] = [
    {
      id: 'webhook',
      position: { x: 30, y: 50 },
      data: { label: 'HTTP Webhook' },
      inputs: [],
      outputs: ['right'],
    },
    {
      id: 'filter',
      position: { x: 260, y: 50 },
      data: { label: 'Payload Filter' },
      inputs: ['left'],
      outputs: ['right', 'bottom'],
    },
    {
      id: 'db',
      position: { x: 500, y: 50 },
      data: { label: 'Store in Database' },
      inputs: ['left'],
      outputs: [],
    },
    {
      id: 'slack',
      position: { x: 260, y: 180 },
      data: { label: 'Notify Slack' },
      inputs: ['top'],
      outputs: [],
    },
  ];

  readonly edges: FlowEdge[] = [
    {
      id: 'e1',
      source: 'webhook',
      target: 'filter',
      type: 'bezier',
      variant: 'animated-dashed',
    },
    {
      id: 'e2',
      source: 'filter',
      target: 'db',
      sourceHandle: 'right',
      targetHandle: 'left',
      type: 'smoothstep',
      variant: 'solid',
    },
    {
      id: 'e3',
      source: 'filter',
      target: 'slack',
      sourceHandle: 'bottom',
      targetHandle: 'top',
      type: 'smoothstep',
      variant: 'dashed',
    },
  ];

  zoomOut() {
    this.zoom.update((z) => Math.max(0.5, Number((z - 0.1).toFixed(1))));
  }

  zoomIn() {
    this.zoom.update((z) => Math.min(2, Number((z + 0.1).toFixed(1))));
  }

  resetZoom() {
    this.zoom.set(1);
  }
}

```


================================================================================
# COMPONENT: FORM
================================================================================

## Documentation

# form — Angular

Processed requirements of [`<z-form>`](../../../../../requirements/04-components/form/form.md) for Angular
(`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component } from '@angular/core';
import { ZForm } from '@zelviora/angular';

@Component({
  selector: 'app-contact',
  imports: [ZForm],
  template: `
    <z-form [summary]="true" (zSubmit)="save($event.detail.values)">
      <form>…</form>
    </z-form>
  `,
})
export class Contact { save(values: unknown) { /* … */ } }
```

`z-form` enhances the native `<form>` written as its first child; it never sends requests. Cancel `(zSubmit)` (or set
`[preventSubmit]="true"`) to stop the native submit.

## With Angular Forms

Importing `FormsModule` turns every `<form>` of the component into an `NgForm` and Angular adds `novalidate`
(F15, ADR-023); `ReactiveFormsModule` does the same for `[formGroup]`. In that case prefer the Angular flow
(`ngModel` / `formControl` through the value accessors, `(ngSubmit)`) and pass errors to `z-field [error]`. The demos here
do not import `FormsModule`, so `z-form` handles the native form.

## Binding

No model event, no value accessor. Methods (through a template reference or `viewChild`): `validate()`, `checkValidity()`,
`reset()`, `getValues()`, `getErrors()` (all async). `checkValidity()` checks silently (no error display, no summary); the native `form.checkValidity()` shows errors like a
submit.

## Events

`(zSubmit)` (`{ values, formData, submitter }`, cancelable), `(zInvalid)` (`{ errors }`).

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `form-basic.ts` | D-1 Default, D-8 Error, D-9 Controlled |
| `cross-field` | `form-cross-field.ts` | D-22 Cross-field validation |

Not yet covered: D-23 async validator, D-21 novalidate, D-14 many errors.

## Differences

- Boolean and number props are bound with `[prop]="…"` (`[required]="true"`, `[minLength]="10"`).
- The `basic` description says `zSubmit` (Angular output) instead of `onZSubmit` (React prop).
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZField, ZForm, ZInput, ZStack, ZTextarea } from '@zelviora/angular';

@Component({
  selector: 'demo-form-basic',
  imports: [ZButton, ZField, ZForm, ZInput, ZStack, ZTextarea],
  template: `
    <z-form [summary]="true" [preventSubmit]="true" (zSubmit)="sent.set(stringify($event.detail.values))">
      <form class="demo-narrow">
        <z-stack>
          <z-field label="Full name" [required]="true">
            <z-input name="name" [required]="true"></z-input>
          </z-field>
          <z-field label="Email" [required]="true">
            <z-input name="email" type="email" [required]="true"></z-input>
          </z-field>
          <z-field label="Message" hint="At least 10 characters">
            <z-textarea name="message" [minLength]="10"></z-textarea>
          </z-field>
          <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
            <z-button type="submit">Send</z-button>
            <z-button type="reset" variant="outline" tone="neutral">Reset</z-button>
          </z-stack>
          @if (sent()) {
            <output>{{ sent() }}</output>
          }
        </z-stack>
      </form>
    </z-form>
  `,
})
export class FormBasic {
  readonly sent = signal('');
  readonly stringify = (value: unknown) => JSON.stringify(value);
}

```

### Case: cross-field

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZField, ZForm, ZInput, ZStack } from '@zelviora/angular';

type Ctl = HTMLElement & { value: string; setCustomValidity(message: string): Promise<void> };

/** Cross-field rule through setCustomValidity: the error shows like a native one and blocks submit. */
@Component({
  selector: 'demo-form-cross-field',
  imports: [ZButton, ZField, ZForm, ZInput, ZStack],
  template: `
    <z-form [summary]="true" [preventSubmit]="true">
      <form class="demo-narrow">
        <z-stack>
          <z-field label="Password" [required]="true">
            <z-input name="password" [required]="true" [minLength]="8" (zChange)="check($event)"></z-input>
          </z-field>
          <z-field label="Confirm password" [required]="true">
            <z-input name="confirm" [required]="true" (zInput)="check($event)"></z-input>
          </z-field>
          <z-button type="submit">Create account</z-button>
        </z-stack>
      </form>
    </z-form>
  `,
})
export class FormCrossField {
  check(e: Event) {
    const form = (e.currentTarget as HTMLElement).closest('form');
    const pwd = form?.querySelector<Ctl>('[name="password"]');
    const confirm = form?.querySelector<Ctl>('[name="confirm"]');
    if (!pwd || !confirm) return;
    void confirm.setCustomValidity(confirm.value && confirm.value !== pwd.value ? 'Passwords do not match.' : '');
  }
}

```


================================================================================
# COMPONENT: FUNNEL-CHART
================================================================================

## Documentation

# Funnel chart (`<z-funnel-chart>`)

Sequential stage conversion funnels and ascending pyramids powered by ECharts FunnelChart.

## Installation & Import

```tsx
// React (@zelviora/react-chart)
import { ZFunnelChart } from '@zelviora/react-chart';

// Vue 3 (@zelviora/vue-chart)
import { ZFunnelChart } from '@zelviora/vue-chart';

// Angular (@zelviora/angular-chart)
import { ZFunnelChart } from '@zelviora/angular-chart';

// Web Components (@zelviora/chart)
import '@zelviora/chart';
```

## Key Features

- **Tree-shaken ECharts 6 Core**: Automatically registers only the required ECharts chart module and components.
- **Design System Token Synchronization**: Reads `--z-chart-series-1..8`, `--z-chart-grid-color`, and `--z-chart-axis-color`, reacting automatically to Light/Dark mode and theme preset changes.
- **Built-in Accessibility (WCAG AAA)**: Renders a semantic `<figure>` with `<figcaption>`, interactive `aria-pressed` legend toggles, and a synchronized `<table>` for screen readers.
- **Escape Hatch (`option`)**: Deep-merges any raw ECharts `option` object on top of the declarative props.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZFunnelChart } from '@zelviora/angular-chart';
import { funnelData, funnelSeries } from '../data';

@Component({
  selector: 'demo-funnel-chart-basic',
  imports: [ZFunnelChart],
  template: `
    <z-funnel-chart
      heading="Enterprise Trial Conversion Funnel"
      description="Stage-by-stage progression from landing page visits to signed enterprise contracts."
      xKey="stage" [data]="data" [series]="series"
    ></z-funnel-chart>
  `,
})
export class FunnelChartBasic {
  readonly data = funnelData;
  readonly series = funnelSeries;
}

```

### Case: controlled

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/angular';
import { ZFunnelChart, type ChartPointSelectDetail, type ChartSeriesToggleDetail } from '@zelviora/angular-chart';
import { funnelData, funnelSeries } from '../data';

@Component({
  selector: 'demo-funnel-chart-controlled',
  imports: [ZStack, ZButton, ZBadge, ZText, ZFunnelChart],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <z-button size="sm" variant="outline" (click)="hidden = []">
          Show All Series
        </z-button>
        <z-badge tone="primary" variant="soft">{{ selected }}</z-badge>
        <z-text variant="muted" size="sm">
          Hidden: {{ hidden.length ? hidden.join(', ') : 'none' }}
        </z-text>
      </z-stack>
      <z-funnel-chart
        heading="Enterprise Trial Conversion Funnel (Interactive)"
        description="Stage-by-stage progression from landing page visits to signed enterprise contracts."
        xKey="stage" [data]="data" [series]="series"
        [selectable]="true"
        [hiddenSeries]="hidden"
        (zSeriesToggle)="onToggle($event)"
        (zPointSelect)="onSelect($event)"
      ></z-funnel-chart>
    </z-stack>
  `,
})
export class FunnelChartControlled {
  readonly data = funnelData;
  readonly series = funnelSeries;
  hidden: string[] = [];
  selected = 'Click any chart element to inspect';

  onToggle(e: CustomEvent<ChartSeriesToggleDetail>) {
    this.hidden = e.detail.hiddenSeries;
  }

  onSelect(e: CustomEvent<ChartPointSelectDetail>) {
    this.selected = `Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`;
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZFunnelChart } from '@zelviora/angular-chart';
import { funnelData, funnelSeries } from '../data';

@Component({
  selector: 'demo-funnel-chart-customization',
  imports: [ZFunnelChart],
  template: `
    <z-funnel-chart
      class="demo-chart-brand"
      description="Stage-by-stage progression from landing page visits to signed enterprise contracts."
      [valueFormat]="{ maximumFractionDigits: 1 }"
      xKey="stage" [data]="data" [series]="series" [funnelGap]="4" renderer="canvas"
    >
      <span slot="heading">Enterprise Trial Conversion Funnel — Custom Theme Tokens &amp; Canvas</span>
    </z-funnel-chart>
  `,
})
export class FunnelChartCustomization {
  readonly data = funnelData;
  readonly series = funnelSeries;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZFunnelChart } from '@zelviora/angular-chart';
import { funnelData, funnelSeries } from '../data';

@Component({
  selector: 'demo-funnel-chart-states',
  imports: [ZStack, ZFunnelChart],
  template: `
    <z-stack gap="lg">
      <z-funnel-chart
        heading="Loading State (aria-busy)"
        [loading]="true"
        xKey="stage" [data]="data" [series]="series"
      ></z-funnel-chart>
      <z-funnel-chart
        heading="Empty State"
        [data]="[]"
        [series]="series"
      ></z-funnel-chart>
      <z-funnel-chart
        heading="Expanded Accessible Data Table"
        description="Stage-by-stage progression from landing page visits to signed enterprise contracts."
        [showDataTable]="true"
        xKey="stage" [data]="data" [series]="series"
      ></z-funnel-chart>
    </z-stack>
  `,
})
export class FunnelChartStates {
  readonly data = funnelData;
  readonly series = funnelSeries;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZFunnelChart } from '@zelviora/angular-chart';
import { funnelData, funnelSeries } from '../data';

@Component({
  selector: 'demo-funnel-chart-variants',
  imports: [ZStack, ZFunnelChart],
  template: `
    <z-stack gap="lg">
      <z-funnel-chart
        heading="Ascending Pyramid"
        description="Ascending pyramid ordering vs left-aligned conversion funnel."
        xKey="stage" [data]="data" [series]="series" funnelSort="ascending" [funnelGap]="6"
      ></z-funnel-chart>
      <z-funnel-chart
        heading="Left-Aligned Funnel"
        description="Ascending pyramid ordering vs left-aligned conversion funnel."
        xKey="stage" [data]="data" [series]="series" funnelAlign="left" [funnelGap]="2"
      ></z-funnel-chart>
    </z-stack>
  `,
})
export class FunnelChartVariants {
  readonly data = funnelData;
  readonly series = funnelSeries;
}

```


================================================================================
# COMPONENT: GALLERY
================================================================================

## Documentation

# gallery — Angular

Processed requirements of [`<z-gallery>`](../../../../../requirements/04-components/data-display/gallery.md) for Angular
(`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component, signal } from '@angular/core';
import { ZGallery, ZGalleryItem } from '@zelviora/angular';

@Component({
  selector: 'app-photos',
  imports: [ZGallery, ZGalleryItem],
  template: `
    <z-gallery label="Product photos" [index]="index()" (zChange)="index.set($event.detail.index)">
      <z-gallery-item src="/1.jpg" previewSrc="/1-large.jpg" alt="Front"></z-gallery-item>
    </z-gallery>
  `,
})
export class Photos { readonly index = signal(0); }
```

## Binding

Not a form control: bind `[index]` + `(zChange)` (`{ index, reason }`) and `[open]` + `(zOpenChange)`
(`{ open, reason }`); no value accessor.

Other events: `(zBeforeOpen)` / `(zBeforeClose)` (cancelable), `(zAfterOpen)`, `(zAfterClose)`. Methods on the element
(`viewChild` + `ElementRef`): `show(index?)`, `hide()`, `next()`, `previous()`.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `gallery-default.ts` | D-1 Default (8 images), D-15 Keyboard-only |
| `states` | `gallery-states.ts` | D-6 States (captions, loop), D-8 Error (broken image) |
| `controlled` | `gallery-controlled.ts` | D-9 Controlled (`open` + `index`) |
| `data` | `gallery-data.ts` | D-14 Long content (300 images, `items` + `lazy`, long caption) |
| `composition` | `gallery-composition.ts` | D-17 Composition (card) |
| `customization` | `gallery-customization.ts` | D-18 Customization (`columns="3"`, tokens, `::part(counter)`) |
| `i18n` | `gallery-i18n.ts` | D-19 i18n (vi counter), D-11 RTL |
| `empty` | `gallery-empty.ts` | D-20 Empty |

D-2 Playground, D-12 Dark, D-13 Brand showcase and D-16 Density come from the docs site (theme, brand and density
switchers); D-3..D-5, D-7 Disabled and D-10 In form do not apply. Pictures are inline SVG (no external image).

Rules used by the `data` and `customization` demos (`demo.css`):

```css
.demo-gallery-scroll { max-block-size: 24rem; overflow: auto; }
.demo-gallery-brand {
  --z-gallery-gap: var(--z-gap-lg);
  --z-gallery-radius: var(--z-radius-full);
}
.demo-gallery-brand::part(counter) {
  font-weight: var(--z-font-weight-semibold);
}
```

## Zoom in the lightbox

The lightbox zooms, rotates and pans like the image preview (same buttons and keys): toolbar buttons, `+` / `-` / `0` /
`r` (`Shift+R` rotates back), the wheel and dragging. With the image area focused, the arrow keys move a zoomed image;
otherwise they change the image. Every image and every opening start fitted and unrotated. The button names come from
`labels` (`zoomIn`, `zoomOut`, `rotateLeft`, `rotateRight`, `reset`, `viewport`, `toolbar`) or the image strings.
The tool buttons (zoom, rotate, reset, previous, next) form one toolbar with a single Tab stop: the arrow keys and
Home/End move between them (reversed in RTL) without changing the image; Close is a separate Tab stop.

## Differences

- In data mode (`items`) the list is inside the gallery (shadow DOM); with declared items the gallery element is the list.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: composition

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCard, ZGallery, ZGalleryItem } from '@zelviora/angular';

/** Sample picture kept in the demo (no external image, demo-standards §5). */
const pic = (fill: string, text: string) =>
  `data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 160 120"><rect width="160" height="120" fill="${fill}"/><text x="80" y="68" font-family="sans-serif" font-size="20" text-anchor="middle" fill="#1e293b">${text}</text></svg>`)}`;

/** Attachments of a ticket inside a card, three columns. */
@Component({
  selector: 'demo-gallery-composition',
  imports: [ZCard, ZGallery, ZGalleryItem],
  template: `
    <z-card heading="Attachments" description="3 images" class="demo-narrow">
      <z-gallery label="Attachments" [columns]="3">
        <z-gallery-item [src]="a" alt="Screenshot of the error"></z-gallery-item>
        <z-gallery-item [src]="b" alt="Invoice"></z-gallery-item>
        <z-gallery-item [src]="c" alt="Delivery receipt"></z-gallery-item>
      </z-gallery>
    </z-card>
  `,
})
export class GalleryComposition {
  readonly a = pic('#bfdbfe', 'IMG_01');
  readonly b = pic('#bbf7d0', 'IMG_02');
  readonly c = pic('#fde68a', 'IMG_03');
}

```

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZGallery, ZGalleryItem, ZStack } from '@zelviora/angular';

/** Sample picture kept in the demo (no external image, demo-standards §5). */
const pic = (fill: string, text: string) =>
  `data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 160 120"><rect width="160" height="120" fill="${fill}"/><text x="80" y="68" font-family="sans-serif" font-size="20" text-anchor="middle" fill="#1e293b">${text}</text></svg>`)}`;

/** The app owns `open` and `index`: the button opens the third image from code (no event); the log lists user changes. */
@Component({
  selector: 'demo-gallery-controlled',
  imports: [ZButton, ZGallery, ZGalleryItem, ZStack],
  template: `
    <z-stack>
      <z-gallery
        label="Controlled"
        [open]="open()"
        [index]="index()"
        (zOpenChange)="open.set($event.detail.open); add('zOpenChange ' + $event.detail.open + ' (' + $event.detail.reason + ')')"
        (zChange)="index.set($event.detail.index); add('zChange ' + $event.detail.index + ' (' + $event.detail.reason + ')')"
      >
        @for (p of photos; track p.alt) {
          <z-gallery-item [src]="p.src" [alt]="p.alt"></z-gallery-item>
        }
      </z-gallery>
      <z-stack orientation="horizontal" gap="sm" [wrap]="true">
        <z-button variant="outline" tone="neutral" (click)="index.set(2); open.set(true)">Open image 3</z-button>
      </z-stack>
      <span>open: {{ open() }} · index: {{ index() }}</span>
      <output>{{ log().join(' · ') }}</output>
    </z-stack>
  `,
})
export class GalleryControlled {
  readonly photos = ['#bfdbfe', '#fecaca', '#bbf7d0', '#fde68a'].map((c, i) => ({ src: pic(c, `Photo ${i + 1}`), alt: `Photo ${i + 1}` }));
  readonly open = signal(false);
  readonly index = signal(0);
  readonly log = signal<string[]>([]);

  add(line: string) {
    this.log.update((l) => [line, ...l].slice(0, 5));
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGallery, ZGalleryItem } from '@zelviora/angular';

/** Sample picture kept in the demo (no external image, demo-standards §5). */
const pic = (fill: string, text: string) =>
  `data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 160 120"><rect width="160" height="120" fill="${fill}"/><text x="80" y="68" font-family="sans-serif" font-size="20" text-anchor="middle" fill="#1e293b">${text}</text></svg>`)}`;

/** `columns="3"`, gallery tokens (gap, radius) and the lightbox counter part: see `demo-gallery-brand` in README. */
@Component({
  selector: 'demo-gallery-customization',
  imports: [ZGallery, ZGalleryItem],
  template: `
    <z-gallery class="demo-gallery-brand" label="Customization" [columns]="3">
      @for (p of photos; track p.alt) {
        <z-gallery-item [src]="p.src" [alt]="p.alt"></z-gallery-item>
      }
    </z-gallery>
  `,
})
export class GalleryCustomization {
  readonly photos = ['#bfdbfe', '#fecaca', '#bbf7d0', '#fde68a', '#ddd6fe', '#fbcfe8'].map((c, i) => ({ src: pic(c, `${i + 1}`), alt: `Photo ${i + 1}` }));
}

```

### Case: data

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGallery } from '@zelviora/angular';

/** Sample picture kept in the demo (no external image, demo-standards §5). */
const pic = (fill: string, text: string) =>
  `data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 160 120"><rect width="160" height="120" fill="${fill}"/><text x="80" y="68" font-family="sans-serif" font-size="20" text-anchor="middle" fill="#1e293b">${text}</text></svg>`)}`;
const COLORS = ['#bfdbfe', '#fecaca', '#bbf7d0', '#fde68a', '#ddd6fe'];

/** 300 images through `items` + `lazy`: only thumbnails near the viewport are created. */
@Component({
  selector: 'demo-gallery-data',
  imports: [ZGallery],
  template: `
    <div class="demo-gallery-scroll">
      <z-gallery label="Album of 300 photos" [items]="items" [lazy]="true"></z-gallery>
    </div>
  `,
})
export class GalleryData {
  readonly items = Array.from({ length: 300 }, (_, i) => ({
    src: pic(COLORS[i % COLORS.length]!, String(i + 1)),
    alt: `Photo ${i + 1}`,
    caption: i === 0 ? 'A long caption for the first photo of the album that wraps inside a small cell' : undefined,
  }));
}

```

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGallery, ZGalleryItem } from '@zelviora/angular';

/** Sample picture kept in the demo (no external image, demo-standards §5). */
const pic = (fill: string, text: string) =>
  `data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 160 120"><rect width="160" height="120" fill="${fill}"/><text x="80" y="68" font-family="sans-serif" font-size="20" text-anchor="middle" fill="#1e293b">${text}</text></svg>`)}`;
const COLORS = ['#bfdbfe', '#fecaca', '#bbf7d0', '#fde68a', '#ddd6fe', '#fbcfe8', '#a5f3fc', '#fed7aa'];

/** Eight thumbnails: each is a button (one Tab stop); Enter opens the lightbox, ←/→ change the image, Escape closes. */
@Component({
  selector: 'demo-gallery-default',
  imports: [ZGallery, ZGalleryItem],
  template: `
    <z-gallery label="Product photos">
      @for (p of photos; track p.alt) {
        <z-gallery-item [src]="p.src" [alt]="p.alt"></z-gallery-item>
      }
    </z-gallery>
  `,
})
export class GalleryDefault {
  readonly photos = COLORS.map((c, i) => ({ src: pic(c, `Photo ${i + 1}`), alt: `Product photo ${i + 1}` }));
}

```

### Case: empty

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGallery } from '@zelviora/angular';

/** No image: the gallery shows its empty text and `show()` does nothing. */
@Component({
  selector: 'demo-gallery-empty',
  imports: [ZGallery],
  template: `<z-gallery label="Empty album"></z-gallery>`,
})
export class GalleryEmpty {}

```

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGallery, ZGalleryItem, ZStack } from '@zelviora/angular';

/** Sample picture kept in the demo (no external image, demo-standards §5). */
const pic = (fill: string, text: string) =>
  `data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 160 120"><rect width="160" height="120" fill="${fill}"/><text x="80" y="68" font-family="sans-serif" font-size="20" text-anchor="middle" fill="#1e293b">${text}</text></svg>`)}`;

/** Counter and buttons follow the locale ("Ảnh 2 trên 3"); in RTL ←/→ are swapped. */
@Component({
  selector: 'demo-gallery-i18n',
  imports: [ZGallery, ZGalleryItem, ZStack],
  template: `
    <z-stack gap="lg">
      <div lang="vi">
        <z-gallery label="Tiếng Việt">
          @for (p of photos; track p.alt) {
            <z-gallery-item [src]="p.src" [alt]="p.alt"></z-gallery-item>
          }
        </z-gallery>
      </div>
      <div dir="rtl" lang="ar">
        <z-gallery label="RTL">
          @for (p of photos; track p.alt) {
            <z-gallery-item [src]="p.src" [alt]="p.alt"></z-gallery-item>
          }
        </z-gallery>
      </div>
    </z-stack>
  `,
})
export class GalleryI18n {
  readonly photos = ['#bfdbfe', '#fecaca', '#bbf7d0'].map((c, i) => ({ src: pic(c, `${i + 1}`), alt: `Ảnh ${i + 1}` }));
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGallery, ZGalleryItem } from '@zelviora/angular';

/** Sample picture kept in the demo (no external image, demo-standards §5). */
const pic = (fill: string, text: string) =>
  `data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 160 120"><rect width="160" height="120" fill="${fill}"/><text x="80" y="68" font-family="sans-serif" font-size="20" text-anchor="middle" fill="#1e293b">${text}</text></svg>`)}`;

/** Captions, a loop through the images, and a broken image (the thumbnail and the lightbox keep the alt text). */
@Component({
  selector: 'demo-gallery-states',
  imports: [ZGallery, ZGalleryItem],
  template: `
    <z-gallery label="Album" [loop]="true">
      <z-gallery-item [src]="front" alt="Front" caption="Front"></z-gallery-item>
      <z-gallery-item [src]="back" alt="Back" caption="Back"></z-gallery-item>
      <z-gallery-item [src]="broken" alt="Broken image" caption="Image failed to load"></z-gallery-item>
    </z-gallery>
  `,
})
export class GalleryStates {
  readonly front = pic('#bfdbfe', 'Front');
  readonly back = pic('#fecaca', 'Back');
  /** Image data that does not decode (a broken image without a network request). */
  readonly broken = 'data:image/png;base64,AAAA';
}

```


================================================================================
# COMPONENT: GAUGE-CHART
================================================================================

## Documentation

# Gauge chart (`<z-gauge-chart>`)

Radial dial and speedometer KPI gauges with configurable arc angles, progress track, and units.

## Installation & Import

```tsx
// React (@zelviora/react-chart)
import { ZGaugeChart } from '@zelviora/react-chart';

// Vue 3 (@zelviora/vue-chart)
import { ZGaugeChart } from '@zelviora/vue-chart';

// Angular (@zelviora/angular-chart)
import { ZGaugeChart } from '@zelviora/angular-chart';

// Web Components (@zelviora/chart)
import '@zelviora/chart';
```

## Key Features

- **Tree-shaken ECharts 6 Core**: Automatically registers only the required ECharts chart module and components.
- **Design System Token Synchronization**: Reads `--z-chart-series-1..8`, `--z-chart-grid-color`, and `--z-chart-axis-color`, reacting automatically to Light/Dark mode and theme preset changes.
- **Built-in Accessibility (WCAG AAA)**: Renders a semantic `<figure>` with `<figcaption>`, interactive `aria-pressed` legend toggles, and a synchronized `<table>` for screen readers.
- **Escape Hatch (`option`)**: Deep-merges any raw ECharts `option` object on top of the declarative props.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGaugeChart } from '@zelviora/angular-chart';
import { gaugeValue, gaugeData, gaugeSeries } from '../data';

@Component({
  selector: 'demo-gauge-chart-basic',
  imports: [ZGaugeChart],
  template: `
    <z-gauge-chart
      heading="Cluster CPU Utilization"
      description="Real-time compute utilization across production worker nodes."
      [value]="value" [min]="0" [max]="100" unit="%" [data]="data" [series]="series"
    ></z-gauge-chart>
  `,
})
export class GaugeChartBasic {
  readonly value = gaugeValue;
  readonly data = gaugeData;
  readonly series = gaugeSeries;
}

```

### Case: controlled

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/angular';
import { ZGaugeChart, type ChartPointSelectDetail, type ChartSeriesToggleDetail } from '@zelviora/angular-chart';
import { gaugeValue, gaugeData, gaugeSeries } from '../data';

@Component({
  selector: 'demo-gauge-chart-controlled',
  imports: [ZStack, ZButton, ZBadge, ZText, ZGaugeChart],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <z-button size="sm" variant="outline" (click)="hidden = []">
          Show All Series
        </z-button>
        <z-badge tone="primary" variant="soft">{{ selected }}</z-badge>
        <z-text variant="muted" size="sm">
          Hidden: {{ hidden.length ? hidden.join(', ') : 'none' }}
        </z-text>
      </z-stack>
      <z-gauge-chart
        heading="Cluster CPU Utilization (Interactive)"
        description="Real-time compute utilization across production worker nodes."
        [value]="value" [min]="0" [max]="100" unit="%" [data]="data" [series]="series"
        [selectable]="true"
        [hiddenSeries]="hidden"
        (zSeriesToggle)="onToggle($event)"
        (zPointSelect)="onSelect($event)"
      ></z-gauge-chart>
    </z-stack>
  `,
})
export class GaugeChartControlled {
  readonly value = gaugeValue;
  readonly data = gaugeData;
  readonly series = gaugeSeries;
  hidden: string[] = [];
  selected = 'Click any chart element to inspect';

  onToggle(e: CustomEvent<ChartSeriesToggleDetail>) {
    this.hidden = e.detail.hiddenSeries;
  }

  onSelect(e: CustomEvent<ChartPointSelectDetail>) {
    this.selected = `Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`;
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGaugeChart } from '@zelviora/angular-chart';
import { gaugeValue, gaugeData, gaugeSeries } from '../data';

@Component({
  selector: 'demo-gauge-chart-customization',
  imports: [ZGaugeChart],
  template: `
    <z-gauge-chart
      class="demo-chart-brand"
      description="Real-time compute utilization across production worker nodes."
      [valueFormat]="{ maximumFractionDigits: 1 }"
      [value]="value" [min]="0" [max]="100" unit="%" [splitNumber]="4" renderer="canvas" [data]="data" [series]="series"
    >
      <span slot="heading">Cluster CPU Utilization — Custom Theme Tokens &amp; Canvas</span>
    </z-gauge-chart>
  `,
})
export class GaugeChartCustomization {
  readonly value = gaugeValue;
  readonly data = gaugeData;
  readonly series = gaugeSeries;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZGaugeChart } from '@zelviora/angular-chart';
import { gaugeValue, gaugeData, gaugeSeries } from '../data';

@Component({
  selector: 'demo-gauge-chart-states',
  imports: [ZStack, ZGaugeChart],
  template: `
    <z-stack gap="lg">
      <z-gauge-chart
        heading="Loading State (aria-busy)"
        [loading]="true"
        [value]="value" [min]="0" [max]="100" unit="%" [data]="data" [series]="series"
      ></z-gauge-chart>
      <z-gauge-chart
        heading="Empty State"
        [data]="[]"
        [series]="series"
      ></z-gauge-chart>
      <z-gauge-chart
        heading="Expanded Accessible Data Table"
        description="Real-time compute utilization across production worker nodes."
        [showDataTable]="true"
        [value]="value" [min]="0" [max]="100" unit="%" [data]="data" [series]="series"
      ></z-gauge-chart>
    </z-stack>
  `,
})
export class GaugeChartStates {
  readonly value = gaugeValue;
  readonly data = gaugeData;
  readonly series = gaugeSeries;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZGaugeChart } from '@zelviora/angular-chart';
import { gaugeValue, gaugeData, gaugeSeries } from '../data';

@Component({
  selector: 'demo-gauge-chart-variants',
  imports: [ZStack, ZGaugeChart],
  template: `
    <z-stack gap="lg">
      <z-gauge-chart
        heading="Semicircle Latency Dial"
        description="Semicircle latency dial (0–500 ms) vs wide-angle dial without progress bar."
        [value]="185" [min]="0" [max]="500" unit="ms" [startAngle]="180" [endAngle]="0" [splitNumber]="5" [data]="data" [series]="series"
      ></z-gauge-chart>
      <z-gauge-chart
        heading="Classic Scale Dial"
        description="Semicircle latency dial (0–500 ms) vs wide-angle dial without progress bar."
        [value]="82" [min]="0" [max]="100" unit="%" [showProgress]="false" [splitNumber]="10" [data]="data" [series]="series"
      ></z-gauge-chart>
    </z-stack>
  `,
})
export class GaugeChartVariants {
  readonly value = gaugeValue;
  readonly data = gaugeData;
  readonly series = gaugeSeries;
}

```


================================================================================
# COMPONENT: GRAPH-CHART
================================================================================

## Documentation

# Graph chart (`<z-graph-chart>`)

Force-directed and circular network relationship graphs powered by ECharts GraphChart.

## Installation & Import

```tsx
// React (@zelviora/react-chart)
import { ZGraphChart } from '@zelviora/react-chart';

// Vue 3 (@zelviora/vue-chart)
import { ZGraphChart } from '@zelviora/vue-chart';

// Angular (@zelviora/angular-chart)
import { ZGraphChart } from '@zelviora/angular-chart';

// Web Components (@zelviora/chart)
import '@zelviora/chart';
```

## Key Features

- **Tree-shaken ECharts 6 Core**: Automatically registers only the required ECharts chart module and components.
- **Design System Token Synchronization**: Reads `--z-chart-series-1..8`, `--z-chart-grid-color`, and `--z-chart-axis-color`, reacting automatically to Light/Dark mode and theme preset changes.
- **Built-in Accessibility (WCAG AAA)**: Renders a semantic `<figure>` with `<figcaption>`, interactive `aria-pressed` legend toggles, and a synchronized `<table>` for screen readers.
- **Escape Hatch (`option`)**: Deep-merges any raw ECharts `option` object on top of the declarative props.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGraphChart } from '@zelviora/angular-chart';
import { graphCategories, graphNodes, graphLinks, graphSeries } from '../data';

@Component({
  selector: 'demo-graph-chart-basic',
  imports: [ZGraphChart],
  template: `
    <z-graph-chart
      heading="Microservice Dependency Network"
      description="Directed call graph connecting ingress gateways, domain services, and storage engines."
      [nodes]="nodes" [links]="links" [categories]="categories" [series]="series"
    ></z-graph-chart>
  `,
})
export class GraphChartBasic {
  readonly nodes = graphNodes;
  readonly links = graphLinks;
  readonly categories = graphCategories;
  readonly series = graphSeries;
}

```

### Case: controlled

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/angular';
import { ZGraphChart, type ChartPointSelectDetail, type ChartSeriesToggleDetail } from '@zelviora/angular-chart';
import { graphCategories, graphNodes, graphLinks, graphSeries } from '../data';

@Component({
  selector: 'demo-graph-chart-controlled',
  imports: [ZStack, ZButton, ZBadge, ZText, ZGraphChart],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <z-button size="sm" variant="outline" (click)="hidden = []">
          Show All Series
        </z-button>
        <z-badge tone="primary" variant="soft">{{ selected }}</z-badge>
        <z-text variant="muted" size="sm">
          Hidden: {{ hidden.length ? hidden.join(', ') : 'none' }}
        </z-text>
      </z-stack>
      <z-graph-chart
        heading="Microservice Dependency Network (Interactive)"
        description="Directed call graph connecting ingress gateways, domain services, and storage engines."
        [nodes]="nodes" [links]="links" [categories]="categories" [series]="series"
        [selectable]="true"
        [hiddenSeries]="hidden"
        (zSeriesToggle)="onToggle($event)"
        (zPointSelect)="onSelect($event)"
      ></z-graph-chart>
    </z-stack>
  `,
})
export class GraphChartControlled {
  readonly nodes = graphNodes;
  readonly links = graphLinks;
  readonly categories = graphCategories;
  readonly series = graphSeries;
  hidden: string[] = [];
  selected = 'Click any chart element to inspect';

  onToggle(e: CustomEvent<ChartSeriesToggleDetail>) {
    this.hidden = e.detail.hiddenSeries;
  }

  onSelect(e: CustomEvent<ChartPointSelectDetail>) {
    this.selected = `Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`;
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGraphChart } from '@zelviora/angular-chart';
import { graphCategories, graphNodes, graphLinks, graphSeries } from '../data';

@Component({
  selector: 'demo-graph-chart-customization',
  imports: [ZGraphChart],
  template: `
    <z-graph-chart
      class="demo-chart-brand"
      description="Directed call graph connecting ingress gateways, domain services, and storage engines."
      [valueFormat]="{ maximumFractionDigits: 1 }"
      [nodes]="nodes" [links]="links" [categories]="categories" [series]="series" [roam]="true" [curveness]="0.2" renderer="canvas"
    >
      <span slot="heading">Microservice Dependency Network — Custom Theme Tokens &amp; Canvas</span>
    </z-graph-chart>
  `,
})
export class GraphChartCustomization {
  readonly nodes = graphNodes;
  readonly links = graphLinks;
  readonly categories = graphCategories;
  readonly series = graphSeries;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZGraphChart } from '@zelviora/angular-chart';
import { graphCategories, graphNodes, graphLinks, graphSeries } from '../data';

@Component({
  selector: 'demo-graph-chart-states',
  imports: [ZStack, ZGraphChart],
  template: `
    <z-stack gap="lg">
      <z-graph-chart
        heading="Loading State (aria-busy)"
        [loading]="true"
        [nodes]="nodes" [links]="links" [categories]="categories" [series]="series"
      ></z-graph-chart>
      <z-graph-chart
        heading="Empty State"
        [nodes]="[]" [links]="[]"
        [series]="series"
      ></z-graph-chart>
      <z-graph-chart
        heading="Expanded Accessible Data Table"
        description="Directed call graph connecting ingress gateways, domain services, and storage engines."
        [showDataTable]="true"
        [nodes]="nodes" [links]="links" [categories]="categories" [series]="series"
      ></z-graph-chart>
    </z-stack>
  `,
})
export class GraphChartStates {
  readonly nodes = graphNodes;
  readonly links = graphLinks;
  readonly categories = graphCategories;
  readonly series = graphSeries;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZGraphChart } from '@zelviora/angular-chart';
import { graphCategories, graphNodes, graphLinks, graphSeries } from '../data';

@Component({
  selector: 'demo-graph-chart-variants',
  imports: [ZStack, ZGraphChart],
  template: `
    <z-stack gap="lg">
      <z-graph-chart
        heading="Circular Network Layout"
        description="Circular ring network with curved edges vs force-directed layout with high repulsion."
        [nodes]="nodes" [links]="links" [categories]="categories" [series]="series" graphLayout="circular" [curveness]="0.25"
      ></z-graph-chart>
      <z-graph-chart
        heading="Force-Directed Layout"
        description="Circular ring network with curved edges vs force-directed layout with high repulsion."
        [nodes]="nodes" [links]="links" [categories]="categories" [series]="series" graphLayout="force" [repulsion]="240" [symbolSize]="20"
      ></z-graph-chart>
    </z-stack>
  `,
})
export class GraphChartVariants {
  readonly nodes = graphNodes;
  readonly links = graphLinks;
  readonly categories = graphCategories;
  readonly series = graphSeries;
}

```


================================================================================
# COMPONENT: GRID
================================================================================

## Documentation

# grid — Angular

Processed requirements of [`<z-grid>`](../../../../../requirements/04-components/layout/grid.md) for Angular
(`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component } from '@angular/core';
import { ZCard, ZContainer, ZGrid, ZGridItem } from '@zelviora/angular';

@Component({
  selector: 'app-plans',
  imports: [ZCard, ZContainer, ZGrid, ZGridItem],
  template: `
    <z-container>
      <z-grid columns="1 md:2 lg:3" gap="lg">
        <z-card heading="One" />
        <z-grid-item span="1 lg:2"><z-card heading="Wide" /></z-grid-item>
      </z-grid>
    </z-container>
  `,
})
export class Plans {}
```

`columns`, `span` and `start` accept a number (`[columns]="3"`) or a responsive string (`columns="1 sm:2 md:3"`,
breakpoints sm 40rem, md 48rem, lg 64rem, xl 80rem, 2xl 96rem). Breakpoints are **container queries** against the
nearest container (`z-container`), not the viewport; without one, the value without a breakpoint applies.

## Binding

No model event.

## Events

None.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `grid-basic.ts` | D-1 Default, D-11 start |
| `responsive` | `grid-responsive.ts` | D-3 Variants (responsive `columns`) |
| `auto-fill` | `grid-auto-fill.ts` | D-3 Variants (`minColumnWidth`) |
| `gaps` | `grid-gaps.ts` | D-5 Sizes, D-16 Density |
| `composition` | `grid-composition.ts` | D-17 Composition |

Not yet covered: D-2 playground, D-12/D-13 dark and brand, D-14 50 items, D-18 `--z-grid-gap` customization (needs app CSS).

## Differences

- Number props are bound with `[prop]="…"` (`[span]="4"`, `[columns]="2"`) so the value reaches the element as a number;
  responsive values stay static strings.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: auto-fill

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCard, ZGrid } from '@zelviora/angular';

const FILES = ['report.pdf', 'budget.xlsx', 'logo.svg', 'notes.md', 'photo.jpg', 'contract.docx', 'data.csv'];

/** minColumnWidth: as many columns of at least 10rem as fit; no breakpoints needed. */

@Component({
  selector: 'demo-grid-auto-fill',
  imports: [ZCard, ZGrid],
  template: `
    <z-grid minColumnWidth="10rem" gap="sm">
      @for (file of files; track file) {
        <z-card variant="soft" size="sm">{{ file }}</z-card>
      }
    </z-grid>
  `,
})
export class GridAutoFill {
  readonly files = FILES;
}

```

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCard, ZGrid, ZGridItem } from '@zelviora/angular';

/** 12 columns by default; grid items span as many as they need. */

@Component({
  selector: 'demo-grid-basic',
  imports: [ZCard, ZGrid, ZGridItem],
  template: `
    <z-grid gap="sm">
      <z-grid-item [span]="12">
        <z-card variant="soft" size="sm">span 12</z-card>
      </z-grid-item>
      <z-grid-item [span]="8">
        <z-card variant="soft" size="sm">span 8</z-card>
      </z-grid-item>
      <z-grid-item [span]="4">
        <z-card variant="soft" size="sm">span 4</z-card>
      </z-grid-item>
      <z-grid-item [span]="4">
        <z-card variant="soft" size="sm">span 4</z-card>
      </z-grid-item>
      <z-grid-item [span]="4" [start]="9">
        <z-card variant="soft" size="sm">span 4, start 9</z-card>
      </z-grid-item>
    </z-grid>
  `,
})
export class GridBasic {}

```

### Case: composition

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZContainer, ZGrid, ZGridItem, ZLabel, ZStack } from '@zelviora/angular';

/** Two-column form inside a md container; the address spans both columns. */

@Component({
  selector: 'demo-grid-composition',
  imports: [ZButton, ZContainer, ZGrid, ZGridItem, ZLabel, ZStack],
  template: `
    <z-container size="md" padding="none">
      <form (submit)="$event.preventDefault()">
        <z-stack gap="lg">
          <z-grid [columns]="2">
            <z-stack gap="xs">
              <z-label for="grid-first">First name</z-label>
              <input id="grid-first" autocomplete="given-name" />
            </z-stack>
            <z-stack gap="xs">
              <z-label for="grid-last">Last name</z-label>
              <input id="grid-last" autocomplete="family-name" />
            </z-stack>
            <z-grid-item [span]="2">
              <z-stack gap="xs">
                <z-label for="grid-address">Address</z-label>
                <input id="grid-address" autocomplete="street-address" />
              </z-stack>
            </z-grid-item>
          </z-grid>
          <z-stack orientation="horizontal" justify="end" gap="sm">
            <z-button variant="ghost" tone="neutral" type="reset">Clear</z-button>
            <z-button type="submit">Save</z-button>
          </z-stack>
        </z-stack>
      </form>
    </z-container>
  `,
})
export class GridComposition {}

```

### Case: gaps

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCard, ZGrid, ZStack } from '@zelviora/angular';

const GAPS = ['none', 'xs', 'sm', 'md', 'lg'] as const;

/** gap sets both axes; rowGap and columnGap override one axis. All follow the density tokens. */

@Component({
  selector: 'demo-grid-gaps',
  imports: [ZCard, ZGrid, ZStack],
  template: `
    <z-stack gap="lg">
      @for (gap of gaps; track gap) {
        <z-grid [columns]="3" [gap]="gap">
          <z-card variant="soft" size="sm">gap="{{ gap }}"</z-card>
          <z-card variant="soft" size="sm">B</z-card>
          <z-card variant="soft" size="sm">C</z-card>
        </z-grid>
      }
      <z-grid [columns]="3" rowGap="lg" columnGap="xs">
        @for (n of cells; track n) {
          <z-card variant="soft" size="sm">rowGap lg, columnGap xs</z-card>
        }
      </z-grid>
    </z-stack>
  `,
})
export class GridGaps {
  readonly gaps = GAPS;
  readonly cells = ['1', '2', '3', '4', '5', '6'];
}

```

### Case: responsive

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCard, ZContainer, ZGrid } from '@zelviora/angular';

const PLANS = ['Free', 'Team', 'Business', 'Enterprise'];

/**
 * Breakpoints are container queries: the grid follows the width of the nearest container, not the viewport.
 * Two columns, four once the container is at least lg (64rem) wide.
 */

@Component({
  selector: 'demo-grid-responsive',
  imports: [ZCard, ZContainer, ZGrid],
  template: `
    <z-container size="full" padding="none">
      <z-grid columns="2 lg:4">
        @for (plan of plans; track plan) {
          <z-card [heading]="plan">Billed monthly.</z-card>
        }
      </z-grid>
    </z-container>
  `,
})
export class GridResponsive {
  readonly plans = PLANS;
}

```


================================================================================
# COMPONENT: HEADING
================================================================================

## Documentation

# heading — Angular

Processed requirements of [`<z-heading>`](../../../../../requirements/04-components/base/typography.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-heading [level]="2">Report</z-heading>
<article class="z-prose">…</article>
```

## Binding

No model event. User-authored HTML uses the `.z-prose` class of `@zelviora/tokens/prose.css` (load it once in the app).

## Events

None.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `heading-basic.ts` | D-1 Default |
| `sizes` | `heading-sizes.ts` | D-5 Sizes |
| `prose` | `heading-prose.ts` | D-17 Composition, D-19 i18n |

The prose demo needs `@zelviora/tokens/prose.css` (the docs site loads it). Apps import it once:

```css
@import '@zelviora/tokens/prose.css';
```


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZHeading, ZStack, ZText } from '@zelviora/angular';

@Component({
  selector: 'demo-heading-basic',
  imports: [ZHeading, ZStack, ZText],
  template: `
    <z-stack gap="xs">
      <z-heading [level]="2">Revenue report</z-heading>
      <z-text as="p" variant="muted">Figures updated at 08:00, Q3 2026.</z-text>
    </z-stack>
  `,
})
export class HeadingBasic {}

```

### Case: prose

#### Angular
```typescript
import { Component } from '@angular/core';

@Component({
  selector: 'demo-heading-prose',
  template: `
    <article class="z-prose">
      <h2>Changing your password</h2>
      <p>A new password needs at least <strong>8 characters</strong>. See also <a href="#security">the security policy</a>.</p>
      <ol>
        <li>Open the Account page.</li>
        <li>Choose Security, then Change password.</li>
      </ol>
      <blockquote>Do not reuse the password of another account.</blockquote>
      <pre><code>npm install &#64;zelviora/angular</code></pre>
      <table>
        <thead>
          <tr><th>Level</th><th>Length</th></tr>
        </thead>
        <tbody>
          <tr><td>Weak</td><td>under 8</td></tr>
          <tr><td>Strong</td><td>12 or more</td></tr>
        </tbody>
      </table>
    </article>
  `,
})
export class HeadingProse {}

```

### Case: sizes

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZHeading, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-heading-sizes',
  imports: [ZHeading, ZStack],
  template: `
    <z-stack gap="sm">
      @for (size of sizes; track size) {
        <z-heading [level]="3" [size]="size">Level 3 heading, size {{ size }}</z-heading>
      }
    </z-stack>
  `,
})
export class HeadingSizes {
  readonly sizes = ['xl', 'lg', 'md', 'sm'] as const;
}

```


================================================================================
# COMPONENT: HEATMAP-CHART
================================================================================

## Documentation

# Heatmap chart (`<z-heatmap-chart>`)

Two-dimensional matrix intensity heatmap with continuous visualMap color encoding.

## Installation & Import

```tsx
// React (@zelviora/react-chart)
import { ZHeatmapChart } from '@zelviora/react-chart';

// Vue 3 (@zelviora/vue-chart)
import { ZHeatmapChart } from '@zelviora/vue-chart';

// Angular (@zelviora/angular-chart)
import { ZHeatmapChart } from '@zelviora/angular-chart';

// Web Components (@zelviora/chart)
import '@zelviora/chart';
```

## Key Features

- **Tree-shaken ECharts 6 Core**: Automatically registers only the required ECharts chart module and components.
- **Design System Token Synchronization**: Reads `--z-chart-series-1..8`, `--z-chart-grid-color`, and `--z-chart-axis-color`, reacting automatically to Light/Dark mode and theme preset changes.
- **Built-in Accessibility (WCAG AAA)**: Renders a semantic `<figure>` with `<figcaption>`, interactive `aria-pressed` legend toggles, and a synchronized `<table>` for screen readers.
- **Escape Hatch (`option`)**: Deep-merges any raw ECharts `option` object on top of the declarative props.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZHeatmapChart } from '@zelviora/angular-chart';
import { heatmapData, heatmapSeries } from '../data';

@Component({
  selector: 'demo-heatmap-chart-basic',
  imports: [ZHeatmapChart],
  template: `
    <z-heatmap-chart
      heading="Deployment Frequency by Day and Environment"
      description="Number of automated releases across Staging, Canary, and Production from Monday to Friday."
      xKey="day" yKey="env" valueKey="deploys" [data]="data" [series]="series"
    ></z-heatmap-chart>
  `,
})
export class HeatmapChartBasic {
  readonly data = heatmapData;
  readonly series = heatmapSeries;
}

```

### Case: controlled

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/angular';
import { ZHeatmapChart, type ChartPointSelectDetail, type ChartSeriesToggleDetail } from '@zelviora/angular-chart';
import { heatmapData, heatmapSeries } from '../data';

@Component({
  selector: 'demo-heatmap-chart-controlled',
  imports: [ZStack, ZButton, ZBadge, ZText, ZHeatmapChart],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <z-button size="sm" variant="outline" (click)="hidden = []">
          Show All Series
        </z-button>
        <z-badge tone="primary" variant="soft">{{ selected }}</z-badge>
        <z-text variant="muted" size="sm">
          Hidden: {{ hidden.length ? hidden.join(', ') : 'none' }}
        </z-text>
      </z-stack>
      <z-heatmap-chart
        heading="Deployment Frequency by Day and Environment (Interactive)"
        description="Number of automated releases across Staging, Canary, and Production from Monday to Friday."
        xKey="day" yKey="env" valueKey="deploys" [data]="data" [series]="series"
        [selectable]="true"
        [hiddenSeries]="hidden"
        (zSeriesToggle)="onToggle($event)"
        (zPointSelect)="onSelect($event)"
      ></z-heatmap-chart>
    </z-stack>
  `,
})
export class HeatmapChartControlled {
  readonly data = heatmapData;
  readonly series = heatmapSeries;
  hidden: string[] = [];
  selected = 'Click any chart element to inspect';

  onToggle(e: CustomEvent<ChartSeriesToggleDetail>) {
    this.hidden = e.detail.hiddenSeries;
  }

  onSelect(e: CustomEvent<ChartPointSelectDetail>) {
    this.selected = `Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`;
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZHeatmapChart } from '@zelviora/angular-chart';
import { heatmapData, heatmapSeries } from '../data';

@Component({
  selector: 'demo-heatmap-chart-customization',
  imports: [ZHeatmapChart],
  template: `
    <z-heatmap-chart
      class="demo-chart-brand"
      description="Number of automated releases across Staging, Canary, and Production from Monday to Friday."
      [valueFormat]="{ maximumFractionDigits: 1 }"
      xKey="day" yKey="env" valueKey="deploys" [min]="0" [max]="45" renderer="canvas" [data]="data" [series]="series"
    >
      <span slot="heading">Deployment Frequency by Day and Environment — Custom Theme Tokens &amp; Canvas</span>
    </z-heatmap-chart>
  `,
})
export class HeatmapChartCustomization {
  readonly data = heatmapData;
  readonly series = heatmapSeries;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZHeatmapChart } from '@zelviora/angular-chart';
import { heatmapData, heatmapSeries } from '../data';

@Component({
  selector: 'demo-heatmap-chart-states',
  imports: [ZStack, ZHeatmapChart],
  template: `
    <z-stack gap="lg">
      <z-heatmap-chart
        heading="Loading State (aria-busy)"
        [loading]="true"
        xKey="day" yKey="env" valueKey="deploys" [data]="data" [series]="series"
      ></z-heatmap-chart>
      <z-heatmap-chart
        heading="Empty State"
        [data]="[]"
        [series]="series"
      ></z-heatmap-chart>
      <z-heatmap-chart
        heading="Expanded Accessible Data Table"
        description="Number of automated releases across Staging, Canary, and Production from Monday to Friday."
        [showDataTable]="true"
        xKey="day" yKey="env" valueKey="deploys" [data]="data" [series]="series"
      ></z-heatmap-chart>
    </z-stack>
  `,
})
export class HeatmapChartStates {
  readonly data = heatmapData;
  readonly series = heatmapSeries;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZHeatmapChart } from '@zelviora/angular-chart';
import { heatmapData, heatmapSeries } from '../data';

@Component({
  selector: 'demo-heatmap-chart-variants',
  imports: [ZStack, ZHeatmapChart],
  template: `
    <z-stack gap="lg">
      <z-heatmap-chart
        heading="Labeled Matrix with Bounds"
        description="Labeled cells with explicit color scale domain vs unlabeled compact matrix."
        xKey="day" yKey="env" valueKey="deploys" [min]="0" [max]="50" [showLabel]="true" [data]="data" [series]="series"
      ></z-heatmap-chart>
      <z-heatmap-chart
        heading="Unlabeled Color Matrix"
        description="Labeled cells with explicit color scale domain vs unlabeled compact matrix."
        xKey="day" yKey="env" valueKey="deploys" [showLabel]="false" [data]="data" [series]="series"
      ></z-heatmap-chart>
    </z-stack>
  `,
})
export class HeatmapChartVariants {
  readonly data = heatmapData;
  readonly series = heatmapSeries;
}

```


================================================================================
# COMPONENT: HOVER-CARD
================================================================================

## Documentation

# hover-card — Angular

Processed requirements of [`<z-hover-card>`](../../../../../requirements/04-components/overlay-feedback/hover-card.md) for Angular (`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```html
<z-hover-card>
  <a href="/u/lan">&#64;lan</a>
  <div slot="content">Anna Lee · Engineer</div>
</z-hover-card>
```

## Binding

`[open]` + `(zOpenChange)`.

## Events

`(zOpenChange)` (`{ open, reason }`).

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `hover-card-default.ts` | D-1 Default (profile), D-17 Composition |
| `placement` | `hover-card-placement.ts` | D-3 Variants (arrow), D-6 placement / flip |

## Differences

- The card is a supplement: what it shows must also be reachable through the link itself.
- Touch devices do not open it (no hover); the link works as usual.


## Examples & Implementation

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZAvatar, ZHoverCard, ZStack, ZText } from '@zelviora/angular';

@Component({
  selector: 'demo-hover-card-default',
  imports: [ZAvatar, ZHoverCard, ZStack, ZText],
  template: `
    <p>
      Reviewed by
      <z-hover-card>
        <a href="#profile-lan">&#64;lan.nguyen</a>
        <z-stack slot="content" orientation="horizontal" gap="sm">
          <z-avatar name="Anna Lee"></z-avatar>
          <z-stack gap="xs">
            <strong>Anna Lee</strong>
            <z-text variant="muted">Frontend engineer · Hanoi</z-text>
            <a href="#posts-lan">42 posts</a>
          </z-stack>
        </z-stack>
      </z-hover-card>
      yesterday.
    </p>
  `,
})
export class HoverCardDefault {}

```

### Case: placement

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZHoverCard, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-hover-card-placement',
  imports: [ZHoverCard, ZStack],
  template: `
    <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="lg">
      @for (placement of placements; track placement) {
        <z-hover-card [placement]="placement" [arrow]="true" [openDelay]="300">
          <a [href]="'#docs-' + placement">Preview {{ placement }}</a>
          <p slot="content">Opens after the hover delay or on keyboard focus; flips to stay in the viewport.</p>
        </z-hover-card>
      }
    </z-stack>
  `,
})
export class HoverCardPlacement {
  readonly placements = ['top', 'right', 'bottom', 'left'] as const;
}

```


================================================================================
# COMPONENT: ICON
================================================================================

## Documentation

# icon — Angular

Processed requirements of [`<z-icon>`](../../../../../requirements/04-components/base/icon.md) for Angular
(`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component } from '@angular/core';
import { ZIcon } from '@zelviora/angular';
// once per page: add "@zelviora/icons/icons.css" to the `styles` of angular.json, next to tokens.css

@Component({
  selector: 'app-next',
  imports: [ZIcon],
  template: `
    <z-icon name="chevron_right" />                  
    <z-icon name="close" label="Close" size="md" />  
    <z-icon name="star" [filled]="true" />           
  `,
})
export class Next {}
```

Icons come from the Material Symbols icon font of `@zelviora/icons` (ADR-025): use the name shown on
https://fonts.google.com/icons (`chevron_right`; `chevron-right` works too). Without `icons.css` on the page icons stay
empty boxes and a development warning says so once. Your own SVG icons go through `registerIcons` of `@zelviora/icons` and
win over the font icon of the same name (`registry` demo), also inside components: registering `close`, `check`, `expand_more`
or `info` changes the close button, check marks, chevrons and status icons the components draw, so give app icons
another name (`app-close`) unless that is the intent.
The docs site lists every name on its Icons page (`/foundations/icons/`). `name` is typed `IconName | (string & {})`:
Material names autocomplete (`IconName` is exported by `@zelviora/angular`) and any registered icon name is still accepted.
In production, `npx @zelviora/cli icons subset` writes a font with only the icons the app uses (`icons-subset.css`
replaces `icons.css`).

## Binding

No model event (spec §12). Every prop is a string or boolean; bind `flipRtl` with `[flipRtl]="true"`.

## Events

None.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `icon-basic.ts` | D-1 Default |
| `label` | `icon-label.ts` | D-19 i18n / A-2 (meaningful icon with `label`) |
| `sizes` | `icon-sizes.ts` | D-5 Sizes |
| `tones` | `icon-tones.ts` | D-4 Tones (color from the parent, `--z-icon-color`; classes `demo-text-destructive` and `demo-icon-token` of `demo.css`) |
| `rtl` | `icon-rtl.ts` | D-11 RTL |
| `registry` | `icon-registry.ts` | D-21 Registry (app icon) |
| `styles` | `icon-styles.ts` | D-3 Variants: font styles (outlined, rounded, sharp), `filled`, weight / optical size tokens (classes `demo-icon-rounded`, `demo-icon-sharp`, `demo-icon-bold` of `demo.css`) |
| `unknown` | `icon-unknown.ts` | D-8 Error: unknown name → empty box of the icon size + one dev `console.warn` (no console error) |
| `composition` | `icon-composition.ts` | D-17 Composition: button `icon-start`, icon button, input `prefix` slot, sidebar item `icon` slot (class `demo-sidebar-frame` of `demo.css`) |
| `loading` | `icon-loading.ts` | D-20 Empty / loading: glyph hidden while the icon font loads; same-origin `src` (`/demo-assets/rich-text-sample.svg`, served by the docs site) is an empty box until loaded |
| `override` | `icon-override.ts` | D-24 Brand override: `registerIcons({ expand_more })` on a button click changes the select and accordion chevrons (and every other `expand_more` on the page until reload) |

Not yet covered: D-9 runtime `name` change, D-14 large inline text, D-16 density, D-18 `::part(base)`. Icons
registered after first render re-render automatically (D-21, D-24).

`src` (opt-in) loads a same-origin SVG once per URL (`Content-Type: image/svg+xml`) and sanitizes it before insertion;
cross-origin URLs are not requested.

## Styling in an app

Demos never set inline styles (L-DOC-07). The `tones` demo uses two classes of the shared `demo.css`; an app writes the
same rules in its global stylesheet (not in component `styles`: `::part` and custom properties cross the shadow root
from the light DOM):

```css
.demo-text-destructive { color: var(--z-color-destructive-text); } /* the icon follows currentColor */
.demo-icon-token { --z-icon-color: var(--z-color-primary-text); }  /* component token */
.demo-icon-rounded { --z-icon-font-family: "z-symbols-rounded"; } /* another style of the icon font */
.demo-icon-bold { --z-icon-weight: 700; --z-icon-optical-size: 40; } /* variable axes */
```

## Differences

- `registerIcons` (custom SVG icons) runs at module load of the demo file (top level), so icons are registered before the first render.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZIcon } from '@zelviora/angular';

@Component({
  selector: 'demo-icon-basic',
  imports: [ZIcon],
  template: `
    <p>Continue to checkout <z-icon name="chevron_right" /></p>
  `,
})
export class IconBasic {}

```

### Case: composition

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZIcon, ZIconButton, ZInput, ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack } from '@zelviora/angular';

/** The icon inside other components: the icon slot of a button, an icon button, the prefix of an input and sidebar items. */
@Component({
  selector: 'demo-icon-composition',
  imports: [ZButton, ZIcon, ZIconButton, ZInput, ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack],
  template: `
    <z-stack gap="lg">
      <z-stack orientation="horizontal" align-items="center" gap="md" [wrap]="true">
        <z-button>
          <z-icon slot="icon-start" name="save"></z-icon>
          Save
        </z-button>
        <z-icon-button label="Settings">
          <z-icon name="settings"></z-icon>
        </z-icon-button>
      </z-stack>
      <z-input class="demo-narrow" label="Search" placeholder="Search orders">
        <z-icon slot="prefix" name="search"></z-icon>
      </z-input>
      <z-stack orientation="horizontal" class="demo-sidebar-frame">
        <z-sidebar label="Workspace navigation">
          <z-sidebar-group label="Workspace">
            <z-sidebar-item href="#icon-composition-dashboard" [current]="true">
              <z-icon slot="icon" name="dashboard"></z-icon>
              Dashboard
            </z-sidebar-item>
            <z-sidebar-item href="#icon-composition-orders">
              <z-icon slot="icon" name="receipt_long"></z-icon>
              Orders
            </z-sidebar-item>
          </z-sidebar-group>
        </z-sidebar>
        <p class="demo-grow">Page content</p>
      </z-stack>
    </z-stack>
  `,
})
export class IconComposition {}

```

### Case: label

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZIcon } from '@zelviora/angular';

@Component({
  selector: 'demo-icon-label',
  imports: [ZIcon],
  template: `
    <p>Payment status: <z-icon name="close" label="Failed" size="md" /></p>
  `,
})
export class IconLabel {}

```

### Case: loading

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZIcon, ZStack } from '@zelviora/angular';

/** A font glyph stays hidden until the icon font has loaded; a `src` icon is an empty box until its SVG has loaded. */
@Component({
  selector: 'demo-icon-loading',
  imports: [ZIcon, ZStack],
  template: `
    <z-stack orientation="horizontal" align-items="center" gap="lg" [wrap]="true">
      <span><z-icon name="image" size="lg"></z-icon> Icon font glyph</span>
      <span><z-icon [src]="sample" size="lg"></z-icon> Same-origin SVG (src)</span>
    </z-stack>
  `,
})
export class IconLoading {
  /** Same-origin sample picture served by the docs site (apps/document/public/demo-assets). */
  readonly sample = '/demo-assets/rich-text-sample.svg';
}

```

### Case: registry

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZIcon } from '@zelviora/angular';
import { registerIcons } from '@zelviora/icons';

// Trusted static SVG from the app source (never user input), 24x24 and drawn with currentColor.
registerIcons({
  'app-send': {
    svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 12l16-8-6 16-2-7-8-1z"/></svg>',
    flipRtl: true,
  },
});

@Component({
  selector: 'demo-icon-registry',
  imports: [ZIcon],
  template: `
    <p><z-icon name="app-send" size="md" /> Send message</p>
  `,
})
export class IconRegistry {}

```

### Case: rtl

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZIcon, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-icon-rtl',
  imports: [ZIcon, ZStack],
  template: `
    <z-stack gap="sm">
      <p dir="ltr">Next <z-icon name="chevron_right" /> · Close <z-icon name="close" /></p>
      <p dir="rtl" lang="ar">التالي <z-icon name="chevron_right" /> · إغلاق <z-icon name="close" /></p>
    </z-stack>
  `,
})
export class IconRtl {}

```

### Case: sizes

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZIcon, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-icon-sizes',
  imports: [ZIcon, ZStack],
  template: `
    <z-stack orientation="horizontal" align-items="center" gap="lg" [wrap]="true">
      <span>1em <z-icon name="close" /></span>
      <span>sm <z-icon name="close" size="sm" /></span>
      <span>md <z-icon name="close" size="md" /></span>
      <span>lg <z-icon name="close" size="lg" /></span>
    </z-stack>
  `,
})
export class IconSizes {}

```

### Case: styles

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZIcon, ZStack } from '@zelviora/angular';

/** Font styles and axes of the icon font: classes of demo.css set the icon tokens (see README). */
@Component({
  selector: 'demo-icon-styles',
  imports: [ZIcon, ZStack],
  template: `
    <z-stack orientation="horizontal" align-items="center" gap="lg" [wrap]="true">
      <span><z-icon name="settings" size="lg" /> Outlined (brand default)</span>
      <span><z-icon name="settings" size="lg" class="demo-icon-rounded" /> Rounded</span>
      <span><z-icon name="settings" size="lg" class="demo-icon-sharp" /> Sharp</span>
      <span><z-icon name="star" size="lg" [filled]="true" /> Filled</span>
      <span><z-icon name="star" size="lg" class="demo-icon-bold" /> Weight 700</span>
    </z-stack>
  `,
})
export class IconStyles {}

```

### Case: tones

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZIcon, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-icon-tones',
  imports: [ZIcon, ZStack],
  template: `
    <z-stack orientation="horizontal" align-items="center" gap="lg" [wrap]="true">
      <!-- demo.css: .demo-text-destructive sets the text color; .demo-icon-token sets --z-icon-color. -->
      <span class="demo-text-destructive"><z-icon name="close" size="md" /> Inherits the text color</span>
      <span><z-icon name="close" size="md" class="demo-icon-token" /> Icon color token</span>
    </z-stack>
  `,
})
export class IconTones {}

```

### Case: unknown

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZIcon, ZStack } from '@zelviora/angular';

/** A name that is neither registered nor in the icon font leaves an empty box of the icon size (dev warning in the console). */
@Component({
  selector: 'demo-icon-unknown',
  imports: [ZIcon, ZStack],
  template: `
    <z-stack orientation="horizontal" align-items="center" gap="lg" [wrap]="true">
      <span><z-icon name="shopping_cart" size="lg"></z-icon> shopping_cart</span>
      <span><z-icon name="Shopping Cart" size="lg"></z-icon> Shopping Cart (unknown name)</span>
    </z-stack>
  `,
})
export class IconUnknown {}

```


================================================================================
# COMPONENT: ICON-BUTTON
================================================================================

## Documentation

# icon-button — Angular

Processed requirements of [`<z-icon-button>`](../../../../../requirements/04-components/base/icon-button.md) for Angular
(`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component } from '@angular/core';
import { ZIcon, ZIconButton } from '@zelviora/angular';

@Component({
  selector: 'app-close',
  imports: [ZIcon, ZIconButton],
  template: `
    <z-icon-button label="Close" (click)="onClose()">
      <z-icon name="close" />
    </z-icon-button>
  `,
})
export class Close { onClose() {} }
```

`label` is required (or `aria-label`/`aria-labelledby`, which move to the inner button). Put exactly one icon in the
default slot: an icon component with a Material Symbols name (`close`, `chevron_right`; the page loads
`@zelviora/icons/icons.css`), an app icon registered with `registerIcons`, or an `<svg>`. The ligature text of a font icon
is never part of the button name; only `label` is.

## Binding

No model event. Form props (`type`, `name`, `value`, `form`, `formAction`…) behave like the button component.

## Events

Native `click`, `focus`, `blur` (`(click)`…). `click` is blocked while `disabled` or `loading`.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `icon-button-basic.ts` | D-1 Default |
| `variants` | `icon-button-variants.ts` | D-3 Variants |
| `sizes` | `icon-button-sizes.ts` | D-5 Sizes (square/circle) |
| `loading` | `icon-button-loading.ts` | D-9 / D-20 loading driven from outside (signal) |
| `tooltip` | `icon-button-tooltip.ts` | D-21 With tooltip |
| `spa-routing` | `icon-button-spa-routing.ts` | D-22 SPA routing |

## Differences

- `tooltip` shows the label in a tooltip on hover and keyboard focus (not while disabled); the name is read once.
- `loading` is a boolean: bind it (`[loading]="loading()"`).
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZIcon, ZIconButton } from '@zelviora/angular';

@Component({
  selector: 'demo-icon-button-basic',
  imports: [ZIcon, ZIconButton],
  template: `
    <z-icon-button label="Close" (click)="close()">
      <z-icon name="close" />
    </z-icon-button>
  `,
})
export class IconButtonBasic {
  close() {
    console.log('closed');
  }
}

```

### Case: loading

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZIcon, ZIconButton } from '@zelviora/angular';

@Component({
  selector: 'demo-icon-button-loading',
  imports: [ZIcon, ZIconButton],
  template: `
    <z-icon-button label="Delete" variant="soft" tone="destructive" [loading]="loading()" (click)="remove()">
      <z-icon name="close" />
    </z-icon-button>
  `,
})
export class IconButtonLoading {
  readonly loading = signal(false);

  remove() {
    this.loading.set(true);
    setTimeout(() => this.loading.set(false), 1500);
  }
}

```

### Case: sizes

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZIcon, ZIconButton, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-icon-button-sizes',
  imports: [ZIcon, ZIconButton, ZStack],
  template: `
    <z-stack orientation="horizontal" align-items="center" gap="md" [wrap]="true">
      <z-icon-button label="Next" size="sm" variant="outline"><z-icon name="chevron_right" /></z-icon-button>
      <z-icon-button label="Next" size="md" variant="outline"><z-icon name="chevron_right" /></z-icon-button>
      <z-icon-button label="Next" size="lg" variant="outline"><z-icon name="chevron_right" /></z-icon-button>
      <z-icon-button label="Next" size="md" variant="solid" shape="circle"><z-icon name="chevron_right" /></z-icon-button>
    </z-stack>
  `,
})
export class IconButtonSizes {}

```

### Case: spa-routing

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZIcon, ZIconButton } from '@zelviora/angular';

// SPA routing (ADR-026): one (zNavigate) listener routes with the app router; Ctrl/⌘-click still opens a new tab.
@Component({
  selector: 'demo-icon-button-spa-routing',
  imports: [ZIcon, ZIconButton],
  template: `
    <z-icon-button label="Settings" href="#/settings" (zNavigate)="navigate($event)">
      <z-icon name="settings" />
    </z-icon-button>
    <p aria-live="polite">Current route: <code>{{ route }}</code></p>
  `,
})
export class IconButtonSpaRouting {
  route = '#/home';

  /** One zNavigate listener calls the app router (stand-in for `Router.navigateByUrl`). */
  navigate(e: Event): void {
    const ev = e as CustomEvent<{ href: string }>;
    ev.preventDefault();
    this.route = ev.detail.href; // this.router.navigateByUrl(...)
  }
}

```

### Case: tooltip

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZIcon, ZIconButton, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-icon-button-tooltip',
  imports: [ZIcon, ZIconButton, ZStack],
  template: `
    <z-stack orientation="horizontal" align-items="center" gap="md" [wrap]="true">
      <z-icon-button label="Close" [tooltip]="true" variant="outline">
        <z-icon name="close" />
      </z-icon-button>
      <z-icon-button label="Next page" [tooltip]="true" variant="outline">
        <z-icon name="chevron_right" />
      </z-icon-button>
      <z-icon-button label="Disabled: no tooltip" [tooltip]="true" variant="outline" [disabled]="true">
        <z-icon name="close" />
      </z-icon-button>
    </z-stack>
  `,
})
export class IconButtonTooltip {}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZIcon, ZIconButton, ZStack } from '@zelviora/angular';

const VARIANTS = ['solid', 'soft', 'outline', 'ghost', 'dashed'] as const;

@Component({
  selector: 'demo-icon-button-variants',
  imports: [ZIcon, ZIconButton, ZStack],
  template: `
    <z-stack orientation="horizontal" align-items="center" gap="md" [wrap]="true">
      @for (variant of variants; track variant) {
        <z-icon-button [label]="'Close (' + variant + ')'" [variant]="variant" tone="primary">
          <z-icon name="close" />
        </z-icon-button>
      }
    </z-stack>
  `,
})
export class IconButtonVariants {
  readonly variants = VARIANTS;
}

```


================================================================================
# COMPONENT: ICON-PICKER
================================================================================

## Documentation

# icon-picker — Angular

Processed requirements of [`<z-icon-picker>`](../../../../../requirements/04-components/form/icon-picker.md) for Angular
(`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SelectValueAccessor, ZIconPicker } from '@zelviora/angular';

@Component({
  selector: 'app-demo',
  imports: [FormsModule, SelectValueAccessor, ZIconPicker],
  template: `<z-icon-picker name="icon" label="Select icon" [(ngModel)]="icon" [showName]="true" [clearable]="true"></z-icon-picker>`,
})
export class Demo {
  icon = 'favorite';
}
```

## Binding

| Component | Value accessor | Model | Event | Detail |
|---|---|---|---|---|
| `ZIconPicker` | `SelectValueAccessor` | `[(ngModel)]` / `formControl` (`string`) | `(zChange)` / `(zInput)` | `{ value }` |
| `ZIconPicker` | — | `[open]` | `(zOpenChange)` | `{ open, reason }` |

Other events:
- `(zBeforeClose)`: Cancelable event emitted before popup closes.
- `(zSearch)`: Emitted when the search query changes (`{ query }`).

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `icon-picker-default.ts` | D-1 Default, D-2 Trigger preview & placeholder |
| `variants` | `icon-picker-variants.ts` | D-3 Variants (outline/filled, `inline`), D-5 Sizes (sm, md, lg) |
| `states` | `icon-picker-states.ts` | D-6 States (disabled, readonly, warning, success, invalid) |
| `controlled` | `icon-picker-controlled.ts` | D-7 Controlled value & open state, events |
| `form` | `icon-picker-form.ts` | D-8 Native form participation, required validation, reset |
| `custom-icons` | `icon-picker-custom-icons.ts` | D-9 Custom icons subset, pagination size, empty text |
| `i18n` | `icon-picker-i18n.ts` | D-10 Internationalization (English, Vietnamese), RTL |


## Examples & Implementation

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZIconPicker, ZStack } from '@zelviora/angular';

/** Programmatic control of selection and panel open state with event logging. */
@Component({
  selector: 'demo-icon-picker-controlled',
  imports: [ZButton, ZIconPicker, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-icon-picker
        label="Controlled icon"
        [value]="value()"
        [open]="open()"
        [clearable]="true"
        [showName]="true"
        (zInput)="onInput($event)"
        (zChange)="onChange($event)"
        (zOpenChange)="onOpenChange($event)"
        (zSearch)="onSearch($event)"
      ></z-icon-picker>
      <z-stack orientation="horizontal" gap="sm" [wrap]="true">
        <z-button variant="outline" tone="neutral" (click)="open.set(!open())">
          {{ open() ? 'Close' : 'Open' }}
        </z-button>
        <z-button variant="outline" tone="neutral" (click)="value.set('shopping_cart')">
          Select cart
        </z-button>
        <z-button variant="outline" tone="neutral" (click)="value.set('')">
          Clear
        </z-button>
      </z-stack>
      <span>Value: {{ value() || "''" }}</span>
      <output>{{ log().join(' · ') }}</output>
    </z-stack>
  `,
})
export class IconPickerControlled {
  readonly value = signal('star');
  readonly open = signal(false);
  readonly log = signal<string[]>([]);

  add(line: string) {
    this.log.update((l) => [line, ...l].slice(0, 5));
  }

  onInput(e: CustomEvent<{ value: string }>) {
    this.value.set(e.detail.value);
    this.add(`zInput ${e.detail.value || '(none)'}`);
  }

  onChange(e: CustomEvent<{ value: string }>) {
    this.value.set(e.detail.value);
    this.add(`zChange ${e.detail.value || '(none)'}`);
  }

  onOpenChange(e: CustomEvent<{ open: boolean; reason?: string }>) {
    this.open.set(e.detail.open);
    this.add(`zOpenChange ${e.detail.open} (${e.detail.reason})`);
  }

  onSearch(e: CustomEvent<{ query: string }>) {
    this.add(`zSearch "${e.detail.query}"`);
  }
}

```

### Case: custom-icons

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZIconPicker, ZStack } from '@zelviora/angular';

const MEDIA_ICONS = [
  'play_arrow', 'pause', 'stop', 'skip_next', 'skip_previous',
  'fast_forward', 'fast_rewind', 'volume_up', 'volume_down', 'volume_mute',
  'volume_off', 'mic', 'mic_off', 'videocam', 'videocam_off',
  'music_note', 'movie', 'radio', 'repeat', 'shuffle',
];

/** Curated list of media control icons with custom page size. */
@Component({
  selector: 'demo-icon-picker-custom-icons',
  imports: [ZIconPicker, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-icon-picker
        label="Media Player Icon"
        [icons]="mediaIcons"
        [pageSize]="8"
        [value]="icon()"
        [showName]="true"
        [clearable]="true"
        emptyText="No media icon matches search"
        (zChange)="icon.set($event.detail.value)"
      ></z-icon-picker>
      <span>Selected: {{ icon() || '(none)' }}</span>
    </z-stack>
  `,
})
export class IconPickerCustomIcons {
  readonly mediaIcons = MEDIA_ICONS;
  readonly icon = signal('play_arrow');
}

```

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SelectValueAccessor, ZIconPicker, ZStack } from '@zelviora/angular';

/** Click the trigger: search and choose an icon from the popover grid. */
@Component({
  selector: 'demo-icon-picker-default',
  imports: [FormsModule, SelectValueAccessor, ZIconPicker, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-icon-picker
        label="Favorite icon"
        placeholder="Choose an icon..."
        [(ngModel)]="value"
        [clearable]="true"
        [showName]="true"
      ></z-icon-picker>
      <span>Selected: {{ value || '(none)' }}</span>
    </z-stack>
  `,
})
export class IconPickerDefault {
  value = 'favorite';
}

```

### Case: form

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZField, ZIconPicker, ZStack } from '@zelviora/angular';

/** Native form: value submitted as icon name (FormData), required inside a field, reset restores defaults. */
@Component({
  selector: 'demo-icon-picker-form',
  imports: [ZButton, ZField, ZIconPicker, ZStack],
  template: `
    <form class="demo-narrow" (submit)="submit($event)">
      <z-stack>
        <z-field label="Navigation icon" hint="Icon displayed in main menu" [required]="true">
          <z-icon-picker name="navIcon" placeholder="Select an icon..." [required]="true"></z-icon-picker>
        </z-field>
        <z-icon-picker name="actionIcon" label="Action icon" value="add"></z-icon-picker>
        <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
          <z-button type="submit">Submit</z-button>
          <z-button type="reset" variant="outline" tone="neutral">Reset</z-button>
        </z-stack>
        @if (sent()) {
          <output>{{ sent() }}</output>
        }
      </z-stack>
    </form>
  `,
})
export class IconPickerForm {
  readonly sent = signal('');

  submit(e: Event) {
    e.preventDefault();
    this.sent.set(JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]));
  }
}

```

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZConfigProvider, ZGrid, ZIconPicker } from '@zelviora/angular';

/** Trigger placeholder, clear button, and dialog labels follow the locale; panel is mirrored in RTL. */
@Component({
  selector: 'demo-icon-picker-i18n',
  imports: [ZConfigProvider, ZGrid, ZIconPicker],
  template: `
    <z-grid columns="1 sm:3" gap="md">
      <z-config-provider locale="vi">
        <z-icon-picker label="Tiếng Việt" value="settings"></z-icon-picker>
      </z-config-provider>
      <z-config-provider locale="en">
        <z-icon-picker label="English" value="settings"></z-icon-picker>
      </z-config-provider>
      <div dir="rtl" lang="ar-EG">
        <z-icon-picker label="العربية" value="settings"></z-icon-picker>
      </div>
    </z-grid>
  `,
})
export class IconPickerI18n {}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGrid, ZIconPicker } from '@zelviora/angular';

/** Empty (placeholder), filled, clearable, disabled, readonly, invalid, and statuses. */
@Component({
  selector: 'demo-icon-picker-states',
  imports: [ZGrid, ZIconPicker],
  template: `
    <z-grid columns="1 sm:2" gap="md">
      <z-icon-picker label="Empty" placeholder="No icon selected"></z-icon-picker>
      <z-icon-picker label="With value" value="star"></z-icon-picker>
      <z-icon-picker label="Clearable" value="search" [clearable]="true"></z-icon-picker>
      <z-icon-picker label="Disabled" value="lock" [disabled]="true"></z-icon-picker>
      <z-icon-picker label="Readonly" value="visibility" [readonly]="true"></z-icon-picker>
      <z-icon-picker label="Invalid" value="" placeholder="Required" [invalid]="true"></z-icon-picker>
      <z-icon-picker label="Warning" value="warning" status="warning"></z-icon-picker>
      <z-icon-picker label="Success" value="check_circle" status="success"></z-icon-picker>
    </z-grid>
  `,
})
export class IconPickerStates {}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGrid, ZIconPicker, ZStack } from '@zelviora/angular';

/** Outline and filled triggers in every size, and the panel in the flow (`inline`). */
@Component({
  selector: 'demo-icon-picker-variants',
  imports: [ZGrid, ZIconPicker, ZStack],
  template: `
    <z-stack gap="lg">
      <z-grid columns="1 sm:3" gap="md">
        <z-icon-picker label="Small" size="sm" value="home"></z-icon-picker>
        <z-icon-picker label="Medium" size="md" value="home"></z-icon-picker>
        <z-icon-picker label="Large" size="lg" value="home"></z-icon-picker>
        <z-icon-picker label="Small filled" size="sm" variant="filled" value="settings"></z-icon-picker>
        <z-icon-picker label="Medium filled" size="md" variant="filled" value="settings"></z-icon-picker>
        <z-icon-picker label="Large filled" size="lg" variant="filled" value="settings"></z-icon-picker>
      </z-grid>
      <z-icon-picker label="Inline" [inline]="true" value="palette" [pageSize]="30"></z-icon-picker>
    </z-stack>
  `,
})
export class IconPickerVariants {}

```


================================================================================
# COMPONENT: IMAGE
================================================================================

## Documentation

# image — Angular

Processed requirements of [`<z-image>`](../../../../../requirements/04-components/data-display/image.md) for Angular (`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```html
<z-image src="/p/shirt.jpg" alt="Blue shirt, front" [width]="320" [height]="240" [preview]="true" [lazy]="true"></z-image>
```

## Binding

`[open]` + `(zOpenChange)`.

## Events

`(zLoad)`, `(zError)` (`{ error }`, before switching to `fallbackSrc`), `(zBeforeOpen)`, `(zBeforeClose)` (cancelable), `(zOpenChange)`, `(zAfterOpen)`, `(zAfterClose)`.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `preview` | `image-preview.ts` | D-1 Default, D-15 Keyboard-only (zoom, rotate, pan, close) |
| `fit` | `image-fit.ts` | D-3 Variants (`fit`), D-6 States, D-8 Error (fallbackSrc, both failing) |

## Differences

- `alt` is required; `alt=""` marks a decorative image and disables the preview.
- Single-key shortcuts (`+`, `-`, `0`, `r`) only work while focus is inside the preview (WCAG 2.1.4); the wheel zooms without Ctrl there.
- Size the element (CSS `inline-size` / `block-size`) for `fit` to apply; the `.demo-square` class of demo.css does that: `.demo-square { inline-size: var(--z-space-24); block-size: var(--z-space-24); }`.


## Examples & Implementation

### Case: fit

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGrid, ZImage, ZStack, ZText } from '@zelviora/angular';

// Sample picture kept in the demo (no external image, demo-standards §5).
const PICTURE =
  "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='200' viewBox='0 0 300 200'%3E%3Crect width='300' height='200' fill='%23fecaca'/%3E%3Ccircle cx='150' cy='100' r='70' fill='%23b91c1c'/%3E%3C/svg%3E";

/** object-fit values in a square box, then a broken src with fallbackSrc and one without (fallback slot). */
@Component({
  selector: 'demo-image-fit',
  imports: [ZGrid, ZImage, ZStack, ZText],
  template: `
    <z-grid columns="2 md:4" gap="md">
      @for (fit of fits; track fit) {
        <z-stack gap="xs">
          <z-image class="demo-square" [src]="picture" [alt]="'Red circle, fit ' + fit" [fit]="fit"></z-image>
          <z-text variant="muted">{{ fit }}</z-text>
        </z-stack>
      }
      <z-stack gap="xs">
        <z-image class="demo-square" [src]="broken" [fallbackSrc]="picture" alt="Fallback picture"></z-image>
        <z-text variant="muted">fallbackSrc</z-text>
      </z-stack>
      <z-stack gap="xs">
        <z-image class="demo-square" [src]="broken" alt="Product photo"></z-image>
        <z-text variant="muted">error</z-text>
      </z-stack>
    </z-grid>
  `,
})
export class ImageFit {
  readonly picture = PICTURE;
  readonly broken = 'data:image/png;base64,AAAA';
  readonly fits = ['cover', 'contain', 'fill', 'none', 'scale-down'] as const;
}

```

### Case: preview

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZImage } from '@zelviora/angular';

// Sample picture kept in the demo (no external image, demo-standards §5).
const PHOTO =
  "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='800' viewBox='0 0 1200 800'%3E%3Crect width='1200' height='800' fill='%23bfdbfe'/%3E%3Ccircle cx='900' cy='220' r='110' fill='%23fde68a'/%3E%3Cpath d='M0 800 380 360l260 300 170-180 390 320z' fill='%231e3a8a'/%3E%3C/svg%3E";

/** Click, Enter or Space opens the preview: zoom with + / − or the wheel, rotate with r, pan with the arrow keys. */
@Component({
  selector: 'demo-image-preview',
  imports: [ZImage],
  template: `<z-image [src]="photo" alt="Mountains under a yellow sun" [width]="320" [height]="213" [preview]="true"></z-image>`,
})
export class ImagePreview {
  readonly photo = PHOTO;
}

```


================================================================================
# COMPONENT: INPUT
================================================================================

## Documentation

# input — Angular

Processed requirements of [`<z-input>`](../../../../../requirements/04-components/form/input.md) for Angular (`@zelviora/angular`).

## Usage

```ts
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { TextValueAccessor, ZInput } from '@zelviora/angular';

@Component({
  selector: 'app-email',
  imports: [FormsModule, TextValueAccessor, ZInput],
  template: `<z-input label="Email" name="email" type="email" [required]="true" [(ngModel)]="email"></z-input>`,
})
export class Email { email = ''; }
```

`type` is one of `text`, `email`, `url`, `tel`, `search`; numbers, passwords and dates have their own components.
`minLength`/`maxLength` count graphemes. `inputmode`, `enterkeyhint` and `spellcheck` are plain attributes forwarded to the
inner `<input>`.

## Binding

| Value accessor | Model | Model event |
|---|---|---|
| `TextValueAccessor` | `[(ngModel)]` / `formControl` (`string`) | `zInput` (`$event.detail.value`) |

Without forms: bind `[value]` and update it from `(zInput)`. Uncontrolled: pass `defaultValue` or nothing and read the value
from `FormData` or `(zChange)`. Form reset restores `defaultValue` without events; reset the model yourself.

## Events

`(zInput)` (every user change, after IME commit), `(zChange)` (blur or Enter after a change, clear), `(zClear)`.
The native `input` event does not leave the component.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `input-basic.ts` | D-1 Default |
| `error` | `input-error.ts` | D-8 Error, R-9 status |
| `clearable` | `input-clearable.ts` | D-22 Clearable + count, D-24 Search |
| `controlled` | `input-controlled.ts` | D-9 Controlled (`[ngModel]` + `(ngModelChange)`) |

Not yet covered: D-3 variants, D-5 sizes, D-11 RTL, D-17 composition (see field), D-21 prefix/suffix, D-23 IME.

## Differences

- Errors are shown by the component (or the surrounding field) instead of the browser bubble; Angular adds `novalidate` to forms with a form directive.
- Boolean and number props are bound with `[prop]="…"` (`[required]="true"`, `[maxLength]="20"`), so the value reaches the element with its type.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZInput } from '@zelviora/angular';

@Component({
  selector: 'demo-input-basic',
  imports: [ZInput],
  template: `<z-input label="Full name" name="fullName" placeholder="Nguyen Van A" autocomplete="name"></z-input>`,
})
export class InputBasic {}

```

### Case: clearable

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZInput, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-input-clearable',
  imports: [ZInput, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-input label="Dish" [clearable]="true" [showCount]="true" [maxLength]="20" value="Pho 🍜" hint="Length counts characters as you see them"></z-input>
      <z-input label="Search" type="search" [clearable]="true" placeholder="Press Escape to clear"></z-input>
    </z-stack>
  `,
})
export class InputClearable {}

```

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { TextValueAccessor, ZInput, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-input-controlled',
  imports: [FormsModule, TextValueAccessor, ZInput, ZStack],
  template: `
    <z-stack gap="sm" class="demo-narrow">
      <z-input
        label="Coupon code"
        [ngModel]="value()"
        (ngModelChange)="value.set($event.toUpperCase())"
        (zChange)="committed.set($event.detail.value)"
      ></z-input>
      <small>Value: {{ value() || '—' }} · Last change: {{ committed() || '—' }}</small>
    </z-stack>
  `,
})
export class InputControlled {
  readonly value = signal('');
  readonly committed = signal('');
}

```

### Case: error

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZInput, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-input-error',
  imports: [ZButton, ZInput, ZStack],
  template: `
    <form class="demo-narrow" (submit)="$event.preventDefault()">
      <z-stack>
        <z-input label="Email" name="email" type="email" [required]="true" hint="Type a value, clear it and leave the field"></z-input>
        <z-input label="Website" name="site" type="url" value="example"></z-input>
        <z-input label="Username" name="user" status="warning" hint="This name is similar to an existing one" value="an.nguyen"></z-input>
        <z-button type="submit">Submit</z-button>
      </z-stack>
    </form>
  `,
})
export class InputError {}

```


================================================================================
# COMPONENT: INPUT-GROUP
================================================================================

## Documentation

# input-group — Angular

Processed requirements of [`<z-input-group>`](../../../../../requirements/04-components/form/input-group.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-input-group label="Website">
  <z-input-group-addon>https://</z-input-group-addon>
  <z-input name="site" label="Domain"></z-input>
</z-input-group>
```

## Binding

No model event: bind the controls inside. Group `disabled` disables library children through an inherited attribute (wrap native elements in `<fieldset disabled>`). Inside a group the visible label of an input or select is hidden but still names it; use a field around the group for a visible label.

## Events

None.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `input-group-basic.ts` | D-1 Default |
| `sizes` | `input-group-sizes.ts` | D-5 Sizes |
| `disabled` | `input-group-disabled.ts` | D-7 Disabled, D-6 States |
| `composition` | `input-group-composition.ts` | D-17 Composition, D-8 Error |
| `controls` | `input-group-controls.ts` | D-17 Composition (combobox, number-input, date-picker joined), D-11 RTL |


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZInput, ZInputGroup, ZInputGroupAddon } from '@zelviora/angular';

@Component({
  selector: 'demo-input-group-basic',
  imports: [ZInput, ZInputGroup, ZInputGroupAddon],
  template: `
    <div class="demo-narrow">
      <z-input-group label="Website">
        <z-input-group-addon>https://</z-input-group-addon>
        <z-input name="site" label="Domain name" placeholder="example"></z-input>
        <z-input-group-addon>.com</z-input-group-addon>
      </z-input-group>
    </div>
  `,
})
export class InputGroupBasic {}

```

### Case: composition

#### Angular
```typescript
import { Component, computed, signal } from '@angular/core';
import { ZButton, ZField, ZInput, ZInputGroup, ZSelect, ZSelectOption, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-input-group-composition',
  imports: [ZButton, ZField, ZInput, ZInputGroup, ZSelect, ZSelectOption, ZStack],
  template: `
    <z-stack gap="lg" class="demo-narrow">
      <z-input-group label="Price">
        <z-select label="Currency" value="vnd">
          <z-select-option value="vnd">VND</z-select-option>
          <z-select-option value="usd">USD</z-select-option>
        </z-select>
        <z-input label="Amount" name="amount" inputmode="numeric" placeholder="0"></z-input>
      </z-input-group>
      <z-field label="Coupon code" hint="Applied at checkout" [error]="error()">
        <z-input-group>
          <z-input name="coupon" [value]="code()" (zInput)="code.set($event.detail.value.toUpperCase())"></z-input>
          <z-button variant="outline" tone="neutral">Apply</z-button>
        </z-input-group>
      </z-field>
    </z-stack>
  `,
})
export class InputGroupComposition {
  readonly code = signal('SALE');
  readonly error = computed(() => (this.code().trim().length < 6 ? 'The code has 6 characters.' : null));
}

```

### Case: controls

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCombobox, ZDatePicker, ZInputGroup, ZInputGroupAddon, ZNumberInput, ZStack } from '@zelviora/angular';

/** Combobox, number-input and date-picker join like the input: square inner corners, one shared border; RTL mirrors them. */
@Component({
  selector: 'demo-input-group-controls',
  imports: [ZCombobox, ZDatePicker, ZInputGroup, ZInputGroupAddon, ZNumberInput, ZStack],
  template: `
    <z-stack gap="lg">
      <z-input-group label="Transfer">
        <z-combobox label="Currency" [options]="currencies" value="vnd"></z-combobox>
        <z-number-input label="Amount" [value]="250000" [min]="0"></z-number-input>
        <z-date-picker label="Transfer date"></z-date-picker>
      </z-input-group>
      <z-input-group label="Discount" size="sm">
        <z-number-input label="Discount" [value]="10" [min]="0" [max]="100"></z-number-input>
        <z-input-group-addon>%</z-input-group-addon>
      </z-input-group>
      <div dir="rtl">
        <z-input-group label="المبلغ">
          <z-input-group-addon>د.إ</z-input-group-addon>
          <z-number-input label="المبلغ" [value]="1200"></z-number-input>
          <z-date-picker label="التاريخ"></z-date-picker>
        </z-input-group>
      </div>
    </z-stack>
  `,
})
export class InputGroupControls {
  readonly currencies = [
    { value: 'vnd', label: 'VND' },
    { value: 'usd', label: 'USD' },
    { value: 'eur', label: 'EUR' },
  ];
}

```

### Case: disabled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZInput, ZInputGroup, ZStack, ZSwitch } from '@zelviora/angular';

@Component({
  selector: 'demo-input-group-disabled',
  imports: [ZButton, ZInput, ZInputGroup, ZStack, ZSwitch],
  template: `
    <z-stack gap="md" class="demo-narrow">
      <z-switch [checked]="disabled()" (zChange)="disabled.set($event.detail.checked)">Disable the group</z-switch>
      <z-input-group label="Search" [disabled]="disabled()">
        <z-input type="search" label="Search" name="q" value="invoices"></z-input>
        <z-button>Search</z-button>
      </z-input-group>
    </z-stack>
  `,
})
export class InputGroupDisabled {
  readonly disabled = signal(true);
}

```

### Case: sizes

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZInput, ZInputGroup, ZInputGroupAddon, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-input-group-sizes',
  imports: [ZButton, ZInput, ZInputGroup, ZInputGroupAddon, ZStack],
  template: `
    <z-stack gap="md" class="demo-narrow">
      @for (size of sizes; track size) {
        <z-input-group [size]="size" [label]="'Amount ' + size">
          <z-input-group-addon>₫</z-input-group-addon>
          <z-input [label]="'Amount (' + size + ')'" placeholder="0"></z-input>
          <z-button variant="outline" tone="neutral">Apply</z-button>
        </z-input-group>
      }
    </z-stack>
  `,
})
export class InputGroupSizes {
  readonly sizes = ['sm', 'md', 'lg'] as const;
}

```


================================================================================
# COMPONENT: KANBAN
================================================================================

## Documentation

# kanban — Angular

Processed requirements of `z-kanban`, `z-kanban-column` and `z-kanban-card`
([spec](../../../../../requirements/04-components/advanced/kanban.md)) for Angular (`@zelviora/angular`, standalone components).

## Usage

```html
<z-kanban label="Sprint board" (zReorder)="board.update((b) => moveCard(b, $event.detail))">
  @for (col of board(); track col.value) {
    <z-kanban-column [value]="col.value" [label]="col.label">
      @for (card of col.cards; track card.value) {
        <z-kanban-card [value]="card.value" [label]="card.label">{{ card.label }}</z-kanban-card>
      }
    </z-kanban-column>
  }
</z-kanban>
```

The kanban never moves the DOM: the app keeps the board, moves the card on `zReorder` and Angular re-renders
(`moveCard` in `data.ts`, generated from `documents/shared/kanban/data.ts`; `toIndex` counts the target column without
the dragged card). `accepts` is a pure function
bound with `[accepts]="fn"`.

## Binding and events

No model event and no value accessor (spec §12): the data stays in the app.

| Output | Detail | Cancelable |
|---|---|---|
| `(zReorder)` | `{ value, from, to, fromIndex, toIndex, reason }`, `reason`: `'pointer' \| 'keyboard' \| 'menu'` | Yes: `$event.preventDefault()` announces "cancelled" and returns the card |
| `(zDragStart)` / `(zDragEnd)` | `{ value, reason }` (`'pointer' \| 'keyboard'`) | No; not emitted for a move from the menu |

## Moving without dragging

Every move works without dragging (WCAG 2.5.7):

- Click or tap a card handle to lift the card, then click or tap a column or another card to drop it there. The
  events are the ones of a drag (`(zDragStart)` / `(zReorder)` / `(zDragEnd)`, `reason: 'pointer'`); Escape or a second click on
  the handle cancels. The handle has `aria-pressed` while the card is lifted.
- Shift+F10, the Menu key or a right click on a handle opens a menu: Move up, Move down, Move to top, Move to bottom
  and one entry per other column (the card goes to its end). Columns that refuse the card or are disabled are
  disabled in the menu; a column over its `limit` stays available. The choice emits `(zReorder)` with
  `reason: 'menu'`, cancelable like a drop, and no drag start or end.
- The keyboard (Space or Enter, arrows) still works as before.

The app applies the move the same way for every `reason` (`pointer`, `keyboard`, `menu`).

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `kanban-default.ts` | D-1 Default (3 columns × 5 cards), D-15 Keyboard-only (lift, move, drop, Escape) |
| `limits` | `kanban-limits.ts` | D-6 States (over-limit), D-3 Variants (`handle`), D-7 Disabled (card), D-20 Empty (column), `accepts` |
| `controlled` | `kanban-controlled.ts` | D-9 Controlled (app updates data on `zReorder`; conditional cancel) |

Not yet covered: D-2 playground, D-3 vertical orientation, D-11 RTL, D-12 dark / D-13 brand (theme switch of
the docs site), D-14 long content, D-16 density, D-17 composition, D-18 customization, D-19 i18n.
Not applicable: D-4, D-5, D-8, D-10.

## Differences

- `preventDefault()` must run synchronously in the `(zReorder)` handler; take the event (`$event`), not only its detail.
- If the app neither cancels nor updates its data, the card stays where it was although the drop was announced: always
  do one of the two.
- Bind booleans and numbers with `[prop]="…"`; plain attributes are strings.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import type { ZKanbanCustomEvent, ZKanbanDragDetail, ZKanbanReorderDetail } from '@zelviora/core';
import { ZBadge, ZKanban, ZKanbanCard, ZKanbanColumn, ZStack, ZText } from '@zelviora/angular';
import { cancelledLog, controlledDemo, dragStartLog, findCard, moveCard, reorderLog } from '../data';

/**
 * The app owns the data: it applies allowed moves and cancels the others with `preventDefault()` on the cancelable
 * `zReorder` (the card flies back and the "cancelled" announcement is made). Blocked cards cannot leave their column.
 */
@Component({
  selector: 'demo-kanban-controlled',
  imports: [ZBadge, ZKanban, ZKanbanCard, ZKanbanColumn, ZStack, ZText],
  template: `
    <z-stack gap="sm">
      <z-kanban [label]="demo.label" (zDragStart)="onDragStart($event.detail)" (zReorder)="onReorder($event)">
        @for (col of board(); track col.value) {
          <z-kanban-column [value]="col.value" [label]="col.label">
            @for (card of col.cards; track card.value) {
              <z-kanban-card [value]="card.value" [label]="card.label">
                <z-stack gap="xs" align-items="start">
                  <z-text>{{ card.label }}</z-text>
                  @if (card.blocked) {
                    <z-badge tone="destructive">{{ demo.blocked }}</z-badge>
                  } @else {
                    <z-badge>{{ card.tag }}</z-badge>
                  }
                </z-stack>
              </z-kanban-card>
            }
          </z-kanban-column>
        }
      </z-kanban>
      <z-text variant="muted" size="sm">{{ log() }}</z-text>
    </z-stack>
  `,
})
export class KanbanControlled {
  readonly demo = controlledDemo;
  readonly board = signal(controlledDemo.columns);
  readonly log = signal(controlledDemo.initialLog);

  onDragStart(detail: ZKanbanDragDetail) {
    this.log.set(dragStartLog(detail));
  }

  onReorder(e: ZKanbanCustomEvent<ZKanbanReorderDetail>) {
    const d = e.detail;
    const card = findCard(this.board(), d.from, d.value);
    if (card?.blocked && d.to !== d.from) {
      e.preventDefault();
      this.log.set(cancelledLog(card));
      return;
    }
    this.board.update((b) => moveCard(b, d));
    this.log.set(reorderLog(d));
  }
}

```

### Case: default

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import type { ZKanbanReorderDetail } from '@zelviora/core';
import { ZBadge, ZKanban, ZKanbanCard, ZKanbanColumn, ZStack, ZText } from '@zelviora/angular';
import { defaultDemo, moveCard } from '../data';

/**
 * Drag a card with the pointer, or focus its handle: Space / Enter lifts it, the arrow keys move it, Space / Enter drops
 * and Escape cancels. The board never moves DOM itself: the app updates its data on `zReorder`.
 */
@Component({
  selector: 'demo-kanban-default',
  imports: [ZBadge, ZKanban, ZKanbanCard, ZKanbanColumn, ZStack, ZText],
  template: `
    <z-kanban [label]="demo.label" (zReorder)="onReorder($event.detail)">
      @for (col of board(); track col.value) {
        <z-kanban-column [value]="col.value" [label]="col.label">
          @for (card of col.cards; track card.value) {
            <z-kanban-card [value]="card.value" [label]="card.label">
              <z-stack gap="xs" align-items="start">
                <z-text>{{ card.label }}</z-text>
                <z-badge>{{ card.tag }}</z-badge>
              </z-stack>
            </z-kanban-card>
          }
        </z-kanban-column>
      }
    </z-kanban>
  `,
})
export class KanbanDefault {
  readonly demo = defaultDemo;
  readonly board = signal(defaultDemo.columns);

  onReorder(detail: ZKanbanReorderDetail) {
    this.board.update((b) => moveCard(b, detail));
  }
}

```

### Case: limits

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import type { ZKanbanReorderDetail } from '@zelviora/core';
import { ZBadge, ZKanban, ZKanbanCard, ZKanbanColumn, ZStack, ZText } from '@zelviora/angular';
import { fromReview, limitsDemo, moveCard } from '../data';

/**
 * `limit` (WIP limit) shows "count/limit" and the over-limit state without blocking drops; `accepts` refuses drops
 * (no indicator, an announcement instead). `handle`: the pointer drags only from the grip. The first backlog card is
 * disabled; Done starts empty (`empty` slot).
 */
@Component({
  selector: 'demo-kanban-limits',
  imports: [ZBadge, ZKanban, ZKanbanCard, ZKanbanColumn, ZStack, ZText],
  template: `
    <z-kanban [label]="demo.label" [handle]="true" (zReorder)="onReorder($event.detail)">
      @for (col of board(); track col.value) {
        <z-kanban-column
          [value]="col.value"
          [label]="col.label"
          [limit]="col.value === demo.limitColumn ? demo.limit : undefined"
          [accepts]="col.value === demo.acceptsColumn ? accepts : undefined"
        >
          @for (card of col.cards; track card.value) {
            <z-kanban-card [value]="card.value" [label]="card.label" [disabled]="!!card.disabled">
              <z-stack gap="xs" align-items="start">
                <z-text>{{ card.label }}</z-text>
                <z-badge>{{ card.tag }}</z-badge>
              </z-stack>
            </z-kanban-card>
          }
          <z-text slot="empty" variant="muted" size="sm">{{ demo.empty }}</z-text>
        </z-kanban-column>
      }
    </z-kanban>
  `,
})
export class KanbanLimits {
  readonly demo = limitsDemo;
  readonly board = signal(limitsDemo.columns);
  /** Pure predicate (property only, stable reference): only reviewed cards may enter Done. */
  readonly accepts = fromReview;

  onReorder(detail: ZKanbanReorderDetail) {
    this.board.update((b) => moveCard(b, detail));
  }
}

```


================================================================================
# COMPONENT: KBD
================================================================================

## Documentation

# kbd — Angular

Processed requirements of [`<z-kbd>`](../../../../../requirements/04-components/base/kbd.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-kbd keys="Mod+K"></z-kbd>
```

## Customization CSS

```css
.demo-kbd-brand {
  --z-kbd-bg: var(--z-color-primary-soft);
  --z-kbd-fg: var(--z-color-primary-soft-foreground);
  --z-kbd-border-color: var(--z-color-primary);
}
```

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `kbd-basic.ts` | D-1 Default |
| `variants` | `kbd-variants.ts` | D-3 Variants, D-14 Long content |
| `sizes` | `kbd-sizes.ts` | D-5 Sizes |
| `composition` | `kbd-composition.ts` | D-17 Composition, D-18 Customization |


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZKbd, ZStack, ZText } from '@zelviora/angular';

@Component({
  selector: 'demo-kbd-basic',
  imports: [ZKbd, ZStack, ZText],
  template: `
    <z-stack orientation="horizontal" gap="sm" align-items="center" [wrap]="true">
      <z-text>Close with</z-text>
      <z-kbd>Esc</z-kbd>
      <z-text>Search with</z-text>
      <z-kbd keys="Mod+K"></z-kbd>
    </z-stack>
  `,
})
export class KbdBasic {}

```

### Case: composition

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZCard, ZKbd, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-kbd-composition',
  imports: [ZButton, ZCard, ZKbd, ZStack],
  template: `
    <z-card heading="Editor">
      <z-stack orientation="horizontal" gap="sm" align-items="center" [wrap]="true">
        <z-button variant="outline" tone="neutral">Save <z-kbd keys="Mod+S"></z-kbd></z-button>
        <z-button variant="outline" tone="neutral">Undo <z-kbd keys="Mod+Z"></z-kbd></z-button>
        <z-kbd class="demo-kbd-brand" keys="Shift+Enter"></z-kbd>
      </z-stack>
    </z-card>
  `,
})
export class KbdComposition {}

```

### Case: sizes

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZKbd, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-kbd-sizes',
  imports: [ZKbd, ZStack],
  template: `
    <z-stack orientation="horizontal" gap="md" align-items="center">
      <z-kbd keys="Mod+S" size="sm"></z-kbd>
      <z-kbd keys="Mod+S" size="md"></z-kbd>
      <z-kbd keys="Mod+S" size="lg"></z-kbd>
    </z-stack>
  `,
})
export class KbdSizes {}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZKbd, ZStack, ZText } from '@zelviora/angular';

@Component({
  selector: 'demo-kbd-variants',
  imports: [ZKbd, ZStack, ZText],
  template: `
    <z-stack gap="sm">
      <z-stack orientation="horizontal" gap="sm" align-items="center"><z-text>Symbols</z-text><z-kbd keys="Mod+Shift+P" display="symbols"></z-kbd></z-stack>
      <z-stack orientation="horizontal" gap="sm" align-items="center"><z-text>Text</z-text><z-kbd keys="Mod+Shift+P" display="text"></z-kbd></z-stack>
      <z-stack orientation="horizontal" gap="sm" align-items="center"><z-text>Long</z-text><z-kbd keys="Mod+Shift+Alt+ArrowUp"></z-kbd></z-stack>
    </z-stack>
  `,
})
export class KbdVariants {}

```


================================================================================
# COMPONENT: LABEL
================================================================================

## Documentation

# label — Angular

Processed requirements of [`<z-label>`](../../../../../requirements/04-components/base/label.md) for Angular (`@zelviora/angular`).

## Usage

```ts
import { Component } from '@angular/core';
import { ZLabel } from '@zelviora/angular';

@Component({
  selector: 'app-email',
  imports: [ZLabel],
  template: `
    <z-label for="email" [required]="true">Email</z-label>
    <input id="email" required />
  `,
})
export class Email {}
```

`for` is an input of the proxy and is passed to the element as the `for` property. The label text becomes the
control's accessible name (through the FieldControl protocol for library controls, or `aria-label` on a control without a
name). For native inputs a native `<label for>` is still the simplest choice.

## Binding

No model event.

## Events

None (native `click` focuses or toggles the control).

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `label-basic.ts` | D-1 Default |
| `indicators` | `label-indicators.ts` | D-3 Variants (required, optional), D-7 Disabled |
| `checkbox` | `label-checkbox.ts` | D-10 In form (label + checkbox toggles) |

## Differences

- Boolean and number props are bound with `[prop]="…"` (`[required]="true"`, `[maxLength]="20"`), so the value reaches the element with its type.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZLabel, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-label-basic',
  imports: [ZLabel, ZStack],
  template: `
    <z-stack gap="xs" class="demo-narrow">
      <z-label for="label-basic-email">Email</z-label>
      <input id="label-basic-email" type="email" />
    </z-stack>
  `,
})
export class LabelBasic {}

```

### Case: checkbox

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZLabel, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-label-checkbox',
  imports: [ZLabel, ZStack],
  template: `
    <z-stack orientation="horizontal" align-items="center" gap="sm">
      <input id="label-terms" type="checkbox" />
      <z-label for="label-terms">I accept the terms</z-label>
    </z-stack>
  `,
})
export class LabelCheckbox {}

```

### Case: indicators

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZLabel, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-label-indicators',
  imports: [ZLabel, ZStack],
  template: `
    <z-stack gap="md" class="demo-narrow">
      <z-stack gap="xs">
        <z-label for="label-ind-name" [required]="true">Full name</z-label>
        <input id="label-ind-name" required aria-required="true" />
      </z-stack>
      <z-stack gap="xs">
        <z-label for="label-ind-phone" [optional]="true">Phone</z-label>
        <input id="label-ind-phone" type="tel" />
      </z-stack>
      <z-stack gap="xs">
        <z-label for="label-ind-code" [disabled]="true">Promo code</z-label>
        <input id="label-ind-code" disabled />
      </z-stack>
    </z-stack>
  `,
})
export class LabelIndicators {}

```


================================================================================
# COMPONENT: LAYOUT
================================================================================

## Documentation

# layout — Angular

Processed requirements of [`<z-layout>`](../../../../../requirements/04-components/layout/layout.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-layout>
  <z-layout-header [sticky]="true">…</z-layout-header>
  <z-layout>
    <z-layout-sider [collapsible]="true" landmarkRole="navigation" label="Main">…</z-layout-sider>
    <z-layout-content>…</z-layout-content>
  </z-layout>
</z-layout>
```

## Binding

`[collapsed]` + `(zCollapseChange)` on the sider (no value accessor).

## Events

`zCollapseChange` `{ collapsed }` when the user collapses or expands a sider. One `main`, `banner` and `contentinfo` per page: set `disableLandmark` on inner ones.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `layout-basic.ts` | D-1 Default |
| `sider` | `layout-sider.ts` | D-3 Variants, D-6 States |
| `controlled` | `layout-controlled.ts` | D-9 Controlled |
| `sticky` | `layout-sticky.ts` | D-14 Long content |


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZLayout, ZLayoutContent, ZLayoutFooter, ZLayoutHeader, ZText } from '@zelviora/angular';

@Component({
  selector: 'demo-layout-basic',
  imports: [ZLayout, ZLayoutContent, ZLayoutFooter, ZLayoutHeader, ZText],
  template: `
    <!-- Demos sit inside the docs page, which has its own landmarks: the inner ones are switched off. -->
    <z-layout>
      <z-layout-header [disableLandmark]="true">
        <z-text variant="strong">Acme Admin</z-text>
      </z-layout-header>
      <z-layout-content [disableLandmark]="true">
        <z-text as="p" class="demo-pane">Twelve orders are waiting to be shipped today.</z-text>
      </z-layout-content>
      <z-layout-footer [disableLandmark]="true">© 2026 Acme</z-layout-footer>
    </z-layout>
  `,
})
export class LayoutBasic {}

```

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZLayout, ZLayoutContent, ZLayoutSider, ZStack, ZText } from '@zelviora/angular';

@Component({
  selector: 'demo-layout-controlled',
  imports: [ZButton, ZLayout, ZLayoutContent, ZLayoutSider, ZStack, ZText],
  template: `
    <z-stack gap="sm">
      <z-stack orientation="horizontal" align-items="center" gap="sm">
        <z-button size="sm" variant="outline" tone="neutral" (click)="collapsed.set(!collapsed())">
          {{ collapsed() ? 'Show filters' : 'Hide filters' }}
        </z-button>
        <z-text variant="muted" size="sm">collapsed = {{ collapsed() }}</z-text>
      </z-stack>
      <z-layout>
        <z-layout-sider
          [collapsible]="true"
          [collapsed]="collapsed()"
          collapsedWidth="0"
          label="Demo filters"
          (zCollapseChange)="collapsed.set($event.detail.collapsed)"
        >
          <z-text as="p" size="sm">Filters</z-text>
        </z-layout-sider>
        <z-layout-content [disableLandmark]="true">
          <z-text as="p">With a collapsed width of 0 the sider content is inert while hidden.</z-text>
        </z-layout-content>
      </z-layout>
    </z-stack>
  `,
})
export class LayoutControlled {
  readonly collapsed = signal(false);
}

```

### Case: sider

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZLayout, ZLayoutContent, ZLayoutHeader, ZLayoutSider, ZLink, ZStack, ZText } from '@zelviora/angular';

@Component({
  selector: 'demo-layout-sider',
  imports: [ZLayout, ZLayoutContent, ZLayoutHeader, ZLayoutSider, ZLink, ZStack, ZText],
  template: `
    <z-layout>
      <z-layout-header [disableLandmark]="true">
        <z-text variant="strong">Acme Admin</z-text>
      </z-layout-header>
      <z-layout>
        <z-layout-sider [collapsible]="true" landmarkRole="navigation" label="Demo navigation" width="200px">
          <z-stack gap="xs" class="demo-pane">
            <z-link href="#layout-sider-dashboard" underline="hover">Dashboard</z-link>
            <z-link href="#layout-sider-orders" underline="hover">Orders</z-link>
            <z-link href="#layout-sider-customers" underline="hover">Customers</z-link>
          </z-stack>
        </z-layout-sider>
        <z-layout-content [disableLandmark]="true">
          <z-text as="p" class="demo-pane">The sider collapses to the token width with its button; end-side siders are placed after the content.</z-text>
        </z-layout-content>
        <z-layout-sider side="end" landmarkRole="complementary" label="Demo details" width="160px">
          <z-text variant="muted" size="sm" class="demo-pane">Order #1042: paid, ships today.</z-text>
        </z-layout-sider>
      </z-layout>
    </z-layout>
  `,
})
export class LayoutSider {}

```

### Case: sticky

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZLayout, ZLayoutContent, ZLayoutHeader, ZStack, ZText } from '@zelviora/angular';

@Component({
  selector: 'demo-layout-sticky',
  imports: [ZButton, ZLayout, ZLayoutContent, ZLayoutHeader, ZStack, ZText],
  template: `
    <z-layout>
      <z-layout-header [sticky]="true" [disableLandmark]="true">
        <z-text variant="strong">Sticky header</z-text>
      </z-layout-header>
      <z-layout-content [disableLandmark]="true">
        <z-stack gap="sm">
          @for (n of rows; track n) {
            <z-stack orientation="horizontal" align-items="center" gap="sm">
              <z-text>Row {{ n }}</z-text>
              <z-button size="sm" variant="ghost" tone="neutral">Open {{ n }}</z-button>
            </z-stack>
          }
        </z-stack>
      </z-layout-content>
    </z-layout>
  `,
})
export class LayoutSticky {
  readonly rows = Array.from({ length: 12 }, (_, i) => i + 1);
}

```


================================================================================
# COMPONENT: LINE-CHART
================================================================================

## Documentation

# Line chart (`<z-line-chart>`)

Multi-series trend, smooth spline, and step-line charts powered by ECharts LineChart.

## Installation & Import

```tsx
// React (@zelviora/react-chart)
import { ZLineChart } from '@zelviora/react-chart';

// Vue 3 (@zelviora/vue-chart)
import { ZLineChart } from '@zelviora/vue-chart';

// Angular (@zelviora/angular-chart)
import { ZLineChart } from '@zelviora/angular-chart';

// Web Components (@zelviora/chart)
import '@zelviora/chart';
```

## Key Features

- **Tree-shaken ECharts 6 Core**: Automatically registers only the required ECharts chart module and components.
- **Design System Token Synchronization**: Reads `--z-chart-series-1..8`, `--z-chart-grid-color`, and `--z-chart-axis-color`, reacting automatically to Light/Dark mode and theme preset changes.
- **Built-in Accessibility (WCAG AAA)**: Renders a semantic `<figure>` with `<figcaption>`, interactive `aria-pressed` legend toggles, and a synchronized `<table>` for screen readers.
- **Escape Hatch (`option`)**: Deep-merges any raw ECharts `option` object on top of the declarative props.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZLineChart } from '@zelviora/angular-chart';
import { trafficData, trafficSeries } from '../data';

@Component({
  selector: 'demo-line-chart-basic',
  imports: [ZLineChart],
  template: `
    <z-line-chart
      heading="Monthly Active Users by Platform (Thousands)"
      description="Web and Mobile active users grows steadily from January to June."
      xKey="month" [data]="data" [series]="series"
    ></z-line-chart>
  `,
})
export class LineChartBasic {
  readonly data = trafficData;
  readonly series = trafficSeries;
}

```

### Case: controlled

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/angular';
import { ZLineChart, type ChartPointSelectDetail, type ChartSeriesToggleDetail } from '@zelviora/angular-chart';
import { trafficData, trafficSeries } from '../data';

@Component({
  selector: 'demo-line-chart-controlled',
  imports: [ZStack, ZButton, ZBadge, ZText, ZLineChart],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <z-button size="sm" variant="outline" (click)="hidden = []">
          Show All Series
        </z-button>
        <z-badge tone="primary" variant="soft">{{ selected }}</z-badge>
        <z-text variant="muted" size="sm">
          Hidden: {{ hidden.length ? hidden.join(', ') : 'none' }}
        </z-text>
      </z-stack>
      <z-line-chart
        heading="Monthly Active Users by Platform (Thousands) (Interactive)"
        description="Web and Mobile active users grows steadily from January to June."
        xKey="month" [data]="data" [series]="series"
        [selectable]="true"
        [hiddenSeries]="hidden"
        (zSeriesToggle)="onToggle($event)"
        (zPointSelect)="onSelect($event)"
      ></z-line-chart>
    </z-stack>
  `,
})
export class LineChartControlled {
  readonly data = trafficData;
  readonly series = trafficSeries;
  hidden: string[] = [];
  selected = 'Click any chart element to inspect';

  onToggle(e: CustomEvent<ChartSeriesToggleDetail>) {
    this.hidden = e.detail.hiddenSeries;
  }

  onSelect(e: CustomEvent<ChartPointSelectDetail>) {
    this.selected = `Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`;
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZLineChart } from '@zelviora/angular-chart';
import { trafficData, trafficSeries } from '../data';

@Component({
  selector: 'demo-line-chart-customization',
  imports: [ZLineChart],
  template: `
    <z-line-chart
      class="demo-chart-brand"
      description="Web and Mobile active users grows steadily from January to June."
      [valueFormat]="{ maximumFractionDigits: 1 }"
      xKey="month" [data]="data" [series]="series" [smooth]="true" [dataZoom]="true" tooltipMode="point" renderer="canvas"
    >
      <span slot="heading">Monthly Active Users by Platform (Thousands) — Custom Theme Tokens &amp; Canvas</span>
    </z-line-chart>
  `,
})
export class LineChartCustomization {
  readonly data = trafficData;
  readonly series = trafficSeries;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZLineChart } from '@zelviora/angular-chart';
import { trafficData, trafficSeries } from '../data';

@Component({
  selector: 'demo-line-chart-states',
  imports: [ZStack, ZLineChart],
  template: `
    <z-stack gap="lg">
      <z-line-chart
        heading="Loading State (aria-busy)"
        [loading]="true"
        xKey="month" [data]="data" [series]="series"
      ></z-line-chart>
      <z-line-chart
        heading="Empty State"
        [data]="[]"
        [series]="series"
      ></z-line-chart>
      <z-line-chart
        heading="Expanded Accessible Data Table"
        description="Web and Mobile active users grows steadily from January to June."
        [showDataTable]="true"
        xKey="month" [data]="data" [series]="series"
      ></z-line-chart>
    </z-stack>
  `,
})
export class LineChartStates {
  readonly data = trafficData;
  readonly series = trafficSeries;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZLineChart } from '@zelviora/angular-chart';
import { trafficData, trafficSeries } from '../data';

@Component({
  selector: 'demo-line-chart-variants',
  imports: [ZStack, ZLineChart],
  template: `
    <z-stack gap="lg">
      <z-line-chart
        heading="Smooth Spline Line"
        description="Smooth spline interpolation with enlarged symbols vs step-middle line progression."
        xKey="month" [data]="data" [series]="series" [smooth]="true" [symbolSize]="8"
      ></z-line-chart>
      <z-line-chart
        heading="Step-Middle Line"
        description="Smooth spline interpolation with enlarged symbols vs step-middle line progression."
        xKey="month" [data]="data" [series]="series" step="middle" [connectNulls]="true"
      ></z-line-chart>
    </z-stack>
  `,
})
export class LineChartVariants {
  readonly data = trafficData;
  readonly series = trafficSeries;
}

```


================================================================================
# COMPONENT: LINES-CHART
================================================================================

## Documentation

# Lines chart (`<z-lines-chart>`)

2D coordinate trajectory and route flow lines with animated particle trails.

## Installation & Import

```tsx
// React (@zelviora/react-chart)
import { ZLinesChart } from '@zelviora/react-chart';

// Vue 3 (@zelviora/vue-chart)
import { ZLinesChart } from '@zelviora/vue-chart';

// Angular (@zelviora/angular-chart)
import { ZLinesChart } from '@zelviora/angular-chart';

// Web Components (@zelviora/chart)
import '@zelviora/chart';
```

## Key Features

- **Tree-shaken ECharts 6 Core**: Automatically registers only the required ECharts chart module and components.
- **Design System Token Synchronization**: Reads `--z-chart-series-1..8`, `--z-chart-grid-color`, and `--z-chart-axis-color`, reacting automatically to Light/Dark mode and theme preset changes.
- **Built-in Accessibility (WCAG AAA)**: Renders a semantic `<figure>` with `<figcaption>`, interactive `aria-pressed` legend toggles, and a synchronized `<table>` for screen readers.
- **Escape Hatch (`option`)**: Deep-merges any raw ECharts `option` object on top of the declarative props.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZLinesChart } from '@zelviora/angular-chart';
import { routeLines, routeSeries } from '../data';

@Component({
  selector: 'demo-lines-chart-basic',
  imports: [ZLinesChart],
  template: `
    <z-lines-chart
      heading="Inter-Region Replication Routes"
      description="Data replication trajectories connecting regional hubs with animated flow particles."
      [linesData]="linesData" [series]="series"
    ></z-lines-chart>
  `,
})
export class LinesChartBasic {
  readonly linesData = routeLines;
  readonly series = routeSeries;
}

```

### Case: controlled

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/angular';
import { ZLinesChart, type ChartPointSelectDetail, type ChartSeriesToggleDetail } from '@zelviora/angular-chart';
import { routeLines, routeSeries } from '../data';

@Component({
  selector: 'demo-lines-chart-controlled',
  imports: [ZStack, ZButton, ZBadge, ZText, ZLinesChart],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <z-button size="sm" variant="outline" (click)="hidden = []">
          Show All Series
        </z-button>
        <z-badge tone="primary" variant="soft">{{ selected }}</z-badge>
        <z-text variant="muted" size="sm">
          Hidden: {{ hidden.length ? hidden.join(', ') : 'none' }}
        </z-text>
      </z-stack>
      <z-lines-chart
        heading="Inter-Region Replication Routes (Interactive)"
        description="Data replication trajectories connecting regional hubs with animated flow particles."
        [linesData]="linesData" [series]="series"
        [selectable]="true"
        [hiddenSeries]="hidden"
        (zSeriesToggle)="onToggle($event)"
        (zPointSelect)="onSelect($event)"
      ></z-lines-chart>
    </z-stack>
  `,
})
export class LinesChartControlled {
  readonly linesData = routeLines;
  readonly series = routeSeries;
  hidden: string[] = [];
  selected = 'Click any chart element to inspect';

  onToggle(e: CustomEvent<ChartSeriesToggleDetail>) {
    this.hidden = e.detail.hiddenSeries;
  }

  onSelect(e: CustomEvent<ChartPointSelectDetail>) {
    this.selected = `Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`;
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZLinesChart } from '@zelviora/angular-chart';
import { routeLines, routeSeries } from '../data';

@Component({
  selector: 'demo-lines-chart-customization',
  imports: [ZLinesChart],
  template: `
    <z-lines-chart
      class="demo-chart-brand"
      description="Data replication trajectories connecting regional hubs with animated flow particles."
      [valueFormat]="{ maximumFractionDigits: 1 }"
      [linesData]="linesData" [series]="series" [effectShow]="true" [curveness]="0.28" renderer="canvas"
    >
      <span slot="heading">Inter-Region Replication Routes — Custom Theme Tokens &amp; Canvas</span>
    </z-lines-chart>
  `,
})
export class LinesChartCustomization {
  readonly linesData = routeLines;
  readonly series = routeSeries;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZLinesChart } from '@zelviora/angular-chart';
import { routeLines, routeSeries } from '../data';

@Component({
  selector: 'demo-lines-chart-states',
  imports: [ZStack, ZLinesChart],
  template: `
    <z-stack gap="lg">
      <z-lines-chart
        heading="Loading State (aria-busy)"
        [loading]="true"
        [linesData]="linesData" [series]="series"
      ></z-lines-chart>
      <z-lines-chart
        heading="Empty State"
        [linesData]="[]"
        [series]="series"
      ></z-lines-chart>
      <z-lines-chart
        heading="Expanded Accessible Data Table"
        description="Data replication trajectories connecting regional hubs with animated flow particles."
        [showDataTable]="true"
        [linesData]="linesData" [series]="series"
      ></z-lines-chart>
    </z-stack>
  `,
})
export class LinesChartStates {
  readonly linesData = routeLines;
  readonly series = routeSeries;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZLinesChart } from '@zelviora/angular-chart';
import { routeLines, routeSeries } from '../data';

@Component({
  selector: 'demo-lines-chart-variants',
  imports: [ZStack, ZLinesChart],
  template: `
    <z-stack gap="lg">
      <z-lines-chart
        heading="Animated Curved Trajectories"
        description="Animated particle trail with high curvature vs static straight trajectory lines."
        [linesData]="linesData" [series]="series" [effectShow]="true" [curveness]="0.35"
      ></z-lines-chart>
      <z-lines-chart
        heading="Static Direct Vectors"
        description="Animated particle trail with high curvature vs static straight trajectory lines."
        [linesData]="linesData" [series]="series" [effectShow]="false" [curveness]="0"
      ></z-lines-chart>
    </z-stack>
  `,
})
export class LinesChartVariants {
  readonly linesData = routeLines;
  readonly series = routeSeries;
}

```


================================================================================
# COMPONENT: LINK
================================================================================

## Documentation

# link — Angular

Processed requirements of [`<z-link>`](../../../../../requirements/04-components/base/link.md) for Angular (`@zelviora/angular`).

## Usage

```ts
import { Component } from '@angular/core';
import { ZLink } from '@zelviora/angular';

@Component({
  selector: 'app-links',
  imports: [ZLink],
  template: `
    <z-link href="/docs">Documentation</z-link>
    <z-link href="https://example.com" target="_blank">Guide</z-link>
  `,
})
export class Links {}
```

## Router (SPA)

The link emits a cancelable `zNavigate` before the browser follows `href` (ADR-026). Put one listener at the app
root (or on the link), cancel it and call the Angular Router; Ctrl/⌘-click and middle click still open a new tab natively:

```html
<z-link href="/reports" (zNavigate)="$event.preventDefault(); router.navigateByUrl($event.detail.href)">Reports</z-link>
```

See Guides "SPA routing" and the `spa-routing` demo.

## Binding

No model event.

## Events

Native `click`, `focus`, `blur`; `click` is blocked while `disabled`. `zNavigate` (cancelable, detail `{ href, target, reason }`) fires on a plain left click before the
browser follows `href`.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `link-basic.ts` | D-1 Default, D-17 in a paragraph |
| `external` | `link-external.ts` | D-21 External |
| `variants` | `link-variants.ts` | D-3 Variants, D-4 Tones, D-7 Disabled |
| `spa-routing` | `link-spa-routing.ts` | D-22 SPA routing |

## Differences

- `javascript:`, `data:` and `vbscript:` URLs are not rendered (dev warning).
- Boolean and number props are bound with `[prop]="…"` (`[required]="true"`, `[maxLength]="20"`), so the value reaches the element with its type.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZLink } from '@zelviora/angular';

@Component({
  selector: 'demo-link-basic',
  imports: [ZLink],
  template: `
    <p>
      Read the <z-link href="#details">details</z-link> before you continue.
    </p>
  `,
})
export class LinkBasic {}

```

### Case: external

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZLink } from '@zelviora/angular';

@Component({
  selector: 'demo-link-external',
  imports: [ZLink],
  template: `
    <p>
      See the <z-link href="https://www.w3.org/WAI/ARIA/apg/patterns/link/" target="_blank">ARIA link pattern</z-link>; it
      opens in a new tab.
    </p>
  `,
})
export class LinkExternal {}

```

### Case: spa-routing

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZLink } from '@zelviora/angular';

// SPA routing (ADR-026): one (zNavigate) listener routes with the app router; Ctrl/⌘-click still opens a new tab.
@Component({
  selector: 'demo-link-spa-routing',
  imports: [ZLink],
  template: `
    <p>
      Open the <z-link href="#/docs" (zNavigate)="navigate($event)">documentation</z-link> or the
      <z-link href="#/pricing" (zNavigate)="navigate($event)">pricing</z-link> page without a page reload.
    </p>
    <p aria-live="polite">Current route: <code>{{ route }}</code></p>
  `,
})
export class LinkSpaRouting {
  route = '#/home';

  /** One zNavigate listener calls the app router (stand-in for `Router.navigateByUrl`). */
  navigate(e: Event): void {
    const ev = e as CustomEvent<{ href: string }>;
    ev.preventDefault();
    this.route = ev.detail.href; // this.router.navigateByUrl(...)
  }
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZLink, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-link-variants',
  imports: [ZLink, ZStack],
  template: `
    <nav aria-label="Footer">
      <z-stack orientation="horizontal" gap="lg" [wrap]="true">
        <z-link href="#about" underline="hover">About</z-link>
        <z-link href="#privacy" tone="neutral" underline="hover">Privacy</z-link>
        <z-link href="#terms" tone="neutral" underline="none">Terms</z-link>
        <z-link href="#archive" [disabled]="true">Archive</z-link>
      </z-stack>
    </nav>
  `,
})
export class LinkVariants {}

```


================================================================================
# COMPONENT: LIST
================================================================================

## Documentation

# list — Angular

Processed requirements of [`<z-list>`](../../../../../requirements/04-components/data-display/list.md) for Angular
(`@zelviora/angular`, standalone components).

## Usage

```html
<z-list label="Members" [divided]="true">
  @for (m of members; track m.key) {
    <z-list-item [heading]="m.heading" [description]="m.description" [href]="m.href"></z-list-item>
  }
</z-list>
<z-list label="Notifications" virtual="on" maxHeight="24rem" [items]="items" (zLoadMore)="more()"></z-list>
```

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `list-basic.ts` | D-1 Default (5 items), D-15 Keyboard-only (Tab through the heading links) |
| `appearance` | `list-appearance.ts` | D-3 divided / bordered, D-5 Sizes, D-16 Density |
| `states` | `list-states.ts` | D-6 States (loading skeleton, empty), D-7 Disabled item, D-20 Empty / loading |
| `composition` | `list-composition.ts` | D-17 Composition (badges, dropdown menu of actions), D-14 Long content |
| `virtual` | `list-virtual.ts` | D-21 Virtual 10 000 items (data mode, sticky group headers) |
| `load-more` | `list-load-more.ts` | D-22 Load more |
| `rtl` | `list-rtl.ts` | D-11 RTL (Arabic) |

Not applicable: D-4 tones, D-8 error, D-9 controlled, D-10 in form. Not yet covered: D-2 playground, D-12 dark,
D-13 brand showcase, D-18 customization, D-19 i18n (the "Load more" label follows the locale).


## Examples & Implementation

### Case: appearance

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZConfigProvider, ZList, ZListItem, ZStack } from '@zelviora/angular';
import { members } from '../data';

@Component({
  selector: 'demo-list-appearance',
  imports: [ZConfigProvider, ZList, ZListItem, ZStack],
  template: `
    <z-stack gap="lg">
      <z-list label="Small, divided" size="sm" [divided]="true">
        @for (m of three; track m.key) { <z-list-item [heading]="m.heading" [description]="m.description"></z-list-item> }
      </z-list>
      <z-list label="Medium, bordered" [bordered]="true">
        @for (m of three; track m.key) { <z-list-item [heading]="m.heading" [description]="m.description"></z-list-item> }
      </z-list>
      <z-list label="Large, divided and bordered" size="lg" [divided]="true" [bordered]="true">
        @for (m of three; track m.key) { <z-list-item [heading]="m.heading" [description]="m.description"></z-list-item> }
      </z-list>
      <z-config-provider density="compact">
        <z-list label="Compact density" [divided]="true">
          @for (m of three; track m.key) { <z-list-item [heading]="m.heading" [description]="m.description"></z-list-item> }
        </z-list>
      </z-config-provider>
    </z-stack>
  `,
})
export class ListAppearance {
  readonly three = members.slice(0, 3);
}

```

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZList, ZListItem } from '@zelviora/angular';
import { members } from '../data';

@Component({
  selector: 'demo-list-basic',
  imports: [ZList, ZListItem],
  template: `
    <z-list label="Members">
      @for (m of members; track m.key) {
        <z-list-item [heading]="m.heading" [description]="m.description" [href]="m.href"></z-list-item>
      }
    </z-list>
  `,
})
export class ListBasic {
  readonly members = members;
}

```

### Case: composition

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZDropdownMenu, ZList, ZListItem, ZMenuItem } from '@zelviora/angular';
import { members } from '../data';

@Component({
  selector: 'demo-list-composition',
  imports: [ZBadge, ZButton, ZDropdownMenu, ZList, ZListItem, ZMenuItem],
  template: `
    <z-list label="Team" [divided]="true" [bordered]="true">
      @for (m of team; track m.key) {
        <z-list-item [heading]="m.title" [description]="m.description" [href]="m.href">
          <z-badge slot="prefix" tone="primary">{{ m.initials }}</z-badge>
          <z-badge slot="suffix" [tone]="m.online ? 'success' : 'neutral'">{{ m.online ? 'Online' : 'Away' }}</z-badge>
          <z-dropdown-menu slot="actions">
            <z-button slot="trigger" size="sm" variant="ghost" tone="neutral">Actions for {{ m.heading }}</z-button>
            <z-menu-item value="message">Send a message</z-menu-item>
            <z-menu-item value="remove">Remove from team</z-menu-item>
          </z-dropdown-menu>
        </z-list-item>
      }
    </z-list>
  `,
})
export class ListComposition {
  readonly team = members.slice(0, 3).map((m, i) => ({
    ...m,
    title: i === 2 ? `${m.heading} — responsible for the quarterly reporting of every regional office` : m.heading,
    initials: m.heading.split(' ').pop()!.slice(0, 2).toUpperCase(),
    online: i === 0,
  }));
}

```

### Case: load-more

#### Angular
```typescript
import { Component, computed, signal } from '@angular/core';
import { ZList, ZListItem } from '@zelviora/angular';
import { makeItems } from '../data';

const all = makeItems(40);

@Component({
  selector: 'demo-list-load-more',
  imports: [ZList, ZListItem],
  template: `
    <z-list label="Notifications" [divided]="true" [loading]="loading()" [loadMore]="count() < total" (zLoadMore)="more()">
      @for (it of shown(); track it.key) {
        <z-list-item [heading]="it.heading" [description]="it.description" [href]="'#' + it.key"></z-list-item>
      }
    </z-list>
  `,
})
export class ListLoadMore {
  readonly total = all.length;
  readonly count = signal(10);
  readonly loading = signal(false);
  readonly shown = computed(() => all.slice(0, this.count()));
  more() {
    this.loading.set(true);
    setTimeout(() => { this.count.update((c) => c + 10); this.loading.set(false); }, 400);
  }
}

```

### Case: rtl

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZList, ZListItem } from '@zelviora/angular';

@Component({
  selector: 'demo-list-rtl',
  imports: [ZBadge, ZList, ZListItem],
  template: `
    <div dir="rtl" lang="ar">
      <z-list label="الأعضاء" [divided]="true">
        <z-list-item heading="أحمد علي" description="مسؤول" href="#ahmad"><z-badge slot="suffix">جديد</z-badge></z-list-item>
        <z-list-item heading="فاطمة حسن" description="محررة" href="#fatima"></z-list-item>
      </z-list>
    </div>
  `,
})
export class ListRtl {}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZList, ZListItem, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-list-states',
  imports: [ZList, ZListItem, ZStack],
  template: `
    <z-stack gap="lg">
      <z-list label="Loading" [loading]="true"></z-list>
      <z-list label="Empty" emptyText="No members yet"></z-list>
      <z-list label="With a disabled item" [divided]="true">
        <z-list-item heading="Anna Lee" description="Active" href="#member-1"></z-list-item>
        <z-list-item heading="Mark Tran" description="Suspended" href="#member-2" [disabled]="true"></z-list-item>
      </z-list>
    </z-stack>
  `,
})
export class ListStates {}

```

### Case: virtual

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZList } from '@zelviora/angular';
import { makeItems } from '../data';

@Component({
  selector: 'demo-list-virtual',
  imports: [ZList],
  template: `<z-list label="Notifications" virtual="on" maxHeight="24rem" [divided]="true" [items]="items"></z-list>`,
})
export class ListVirtual {
  readonly items = makeItems(10_000, true);
}

```


================================================================================
# COMPONENT: LOADING-OVERLAY
================================================================================

## Documentation

# loading-overlay — Angular

Processed requirements of [`<z-loading-overlay>`](../../../../../requirements/04-components/overlay-feedback/loading-overlay.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-loading-overlay [loading]="busy()">…</z-loading-overlay>
```

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `loading-overlay-basic.ts` | D-1 Default, D-9 Controlled, D-15 Keyboard-only |
| `fullscreen` | `loading-overlay-fullscreen.ts` | D-3 Variants (fullscreen) |
| `indicator` | `loading-overlay-indicator.ts` | D-18 Customization (indicator slot), D-20 Loading |


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZCard, ZLoadingOverlay, ZStack, ZText } from '@zelviora/angular';

@Component({
  selector: 'demo-loading-overlay-basic',
  imports: [ZButton, ZCard, ZLoadingOverlay, ZStack, ZText],
  template: `
    <z-stack gap="md" align-items="start">
      <z-button [disabled]="loading()" (click)="reload()">Reload</z-button>
      <z-loading-overlay [loading]="loading()" message="Loading orders">
        <z-card heading="Orders">
          <z-text>42 open orders, 3 overdue.</z-text>
        </z-card>
      </z-loading-overlay>
    </z-stack>
  `,
})
export class LoadingOverlayBasic {
  readonly loading = signal(false);

  reload() {
    this.loading.set(true);
    setTimeout(() => this.loading.set(false), 2000);
  }
}

```

### Case: fullscreen

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZLoadingOverlay } from '@zelviora/angular';

@Component({
  selector: 'demo-loading-overlay-fullscreen',
  imports: [ZButton, ZLoadingOverlay],
  template: `
    <z-loading-overlay [fullscreen]="true" [loading]="loading()" message="Saving the report">
      <z-button (click)="save()">Save report</z-button>
    </z-loading-overlay>
  `,
})
export class LoadingOverlayFullscreen {
  readonly loading = signal(false);

  save() {
    this.loading.set(true);
    setTimeout(() => this.loading.set(false), 2000);
  }
}

```

### Case: indicator

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCard, ZLoadingOverlay, ZProgress, ZText } from '@zelviora/angular';

@Component({
  selector: 'demo-loading-overlay-indicator',
  imports: [ZCard, ZLoadingOverlay, ZProgress, ZText],
  template: `
    <z-loading-overlay [loading]="true" [delay]="0" message="Syncing">
      <z-card heading="Contacts"><z-text>128 contacts</z-text></z-card>
      <z-progress slot="indicator" label="Syncing"></z-progress>
    </z-loading-overlay>
  `,
})
export class LoadingOverlayIndicator {}

```


================================================================================
# COMPONENT: MAP-CHART
================================================================================

## Documentation

# Map chart (`<z-map-chart>`)

GeoJSON choropleth map chart with automatic map registration, roam, and visualMap color scale.

## Installation & Import

```tsx
// React (@zelviora/react-chart)
import { ZMapChart } from '@zelviora/react-chart';

// Vue 3 (@zelviora/vue-chart)
import { ZMapChart } from '@zelviora/vue-chart';

// Angular (@zelviora/angular-chart)
import { ZMapChart } from '@zelviora/angular-chart';

// Web Components (@zelviora/chart)
import '@zelviora/chart';
```

## Key Features

- **Tree-shaken ECharts 6 Core**: Automatically registers only the required ECharts chart module and components.
- **Design System Token Synchronization**: Reads `--z-chart-series-1..8`, `--z-chart-grid-color`, and `--z-chart-axis-color`, reacting automatically to Light/Dark mode and theme preset changes.
- **Built-in Accessibility (WCAG AAA)**: Renders a semantic `<figure>` with `<figcaption>`, interactive `aria-pressed` legend toggles, and a synchronized `<table>` for screen readers.
- **Escape Hatch (`option`)**: Deep-merges any raw ECharts `option` object on top of the declarative props.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZMapChart } from '@zelviora/angular-chart';
import { demoGeoJson, mapData, mapSeries } from '../data';

@Component({
  selector: 'demo-map-chart-basic',
  imports: [ZMapChart],
  template: `
    <z-map-chart
      heading="Regional Cloud Adoption Choropleth"
      description="Active enterprise deployments across four geographic zones rendered from GeoJSON polygons."
      mapName="zelviora-zones" [geoJson]="geoJson" xKey="name" [data]="data" [series]="series"
    ></z-map-chart>
  `,
})
export class MapChartBasic {
  readonly geoJson = demoGeoJson;
  readonly data = mapData;
  readonly series = mapSeries;
}

```

### Case: controlled

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/angular';
import { ZMapChart, type ChartPointSelectDetail, type ChartSeriesToggleDetail } from '@zelviora/angular-chart';
import { demoGeoJson, mapData, mapSeries } from '../data';

@Component({
  selector: 'demo-map-chart-controlled',
  imports: [ZStack, ZButton, ZBadge, ZText, ZMapChart],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <z-button size="sm" variant="outline" (click)="hidden = []">
          Show All Series
        </z-button>
        <z-badge tone="primary" variant="soft">{{ selected }}</z-badge>
        <z-text variant="muted" size="sm">
          Hidden: {{ hidden.length ? hidden.join(', ') : 'none' }}
        </z-text>
      </z-stack>
      <z-map-chart
        heading="Regional Cloud Adoption Choropleth (Interactive)"
        description="Active enterprise deployments across four geographic zones rendered from GeoJSON polygons."
        mapName="zelviora-zones" [geoJson]="geoJson" xKey="name" [data]="data" [series]="series"
        [selectable]="true"
        [hiddenSeries]="hidden"
        (zSeriesToggle)="onToggle($event)"
        (zPointSelect)="onSelect($event)"
      ></z-map-chart>
    </z-stack>
  `,
})
export class MapChartControlled {
  readonly geoJson = demoGeoJson;
  readonly data = mapData;
  readonly series = mapSeries;
  hidden: string[] = [];
  selected = 'Click any chart element to inspect';

  onToggle(e: CustomEvent<ChartSeriesToggleDetail>) {
    this.hidden = e.detail.hiddenSeries;
  }

  onSelect(e: CustomEvent<ChartPointSelectDetail>) {
    this.selected = `Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`;
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZMapChart } from '@zelviora/angular-chart';
import { demoGeoJson, mapData, mapSeries } from '../data';

@Component({
  selector: 'demo-map-chart-customization',
  imports: [ZMapChart],
  template: `
    <z-map-chart
      class="demo-chart-brand"
      description="Active enterprise deployments across four geographic zones rendered from GeoJSON polygons."
      [valueFormat]="{ maximumFractionDigits: 1 }"
      mapName="zelviora-zones" [geoJson]="geoJson" xKey="name" [min]="100" [max]="600" renderer="canvas" [data]="data" [series]="series"
    >
      <span slot="heading">Regional Cloud Adoption Choropleth — Custom Theme Tokens &amp; Canvas</span>
    </z-map-chart>
  `,
})
export class MapChartCustomization {
  readonly geoJson = demoGeoJson;
  readonly data = mapData;
  readonly series = mapSeries;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZMapChart } from '@zelviora/angular-chart';
import { demoGeoJson, mapData, mapSeries } from '../data';

@Component({
  selector: 'demo-map-chart-states',
  imports: [ZStack, ZMapChart],
  template: `
    <z-stack gap="lg">
      <z-map-chart
        heading="Loading State (aria-busy)"
        [loading]="true"
        mapName="zelviora-zones" [geoJson]="geoJson" xKey="name" [data]="data" [series]="series"
      ></z-map-chart>
      <z-map-chart
        heading="Empty State"
        [data]="[]"
        [series]="series"
      ></z-map-chart>
      <z-map-chart
        heading="Expanded Accessible Data Table"
        description="Active enterprise deployments across four geographic zones rendered from GeoJSON polygons."
        [showDataTable]="true"
        mapName="zelviora-zones" [geoJson]="geoJson" xKey="name" [data]="data" [series]="series"
      ></z-map-chart>
    </z-stack>
  `,
})
export class MapChartStates {
  readonly geoJson = demoGeoJson;
  readonly data = mapData;
  readonly series = mapSeries;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZMapChart } from '@zelviora/angular-chart';
import { demoGeoJson, mapData, mapSeries } from '../data';

@Component({
  selector: 'demo-map-chart-variants',
  imports: [ZStack, ZMapChart],
  template: `
    <z-stack gap="lg">
      <z-map-chart
        heading="Labeled Choropleth with VisualMap"
        description="Interactive roam with region labels vs clean choropleth without visualMap."
        mapName="zelviora-zones" [geoJson]="geoJson" xKey="name" [data]="data" [series]="series" [showLabel]="true" [showVisualMap]="true" [roam]="true"
      ></z-map-chart>
      <z-map-chart
        heading="Minimal Choropleth"
        description="Interactive roam with region labels vs clean choropleth without visualMap."
        mapName="zelviora-zones" [geoJson]="geoJson" xKey="name" [data]="data" [series]="series" [showVisualMap]="false"
      ></z-map-chart>
    </z-stack>
  `,
})
export class MapChartVariants {
  readonly geoJson = demoGeoJson;
  readonly data = mapData;
  readonly series = mapSeries;
}

```


================================================================================
# COMPONENT: MASONRY
================================================================================

## Documentation

# masonry — Angular

Processed requirements of [`<z-masonry>`](../../../../../requirements/04-components/data-display/masonry.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-masonry order="balanced" [columns]="3">
  <z-card>…</z-card>
</z-masonry>
```

## Binding

No model event. Call `relayout()` when content changes height without a resize. Use `order="balanced"` only when the reading order does not matter. Search keyword: "Masonry", "Pinterest layout" (antd `Masonry`).

## Events

| Output | Detail | Notes |
|---|---|---|
| `(zLayoutChange)` | `{ columns }` | The actual column count changed (not for the first layout); not cancelable |

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `masonry-basic.ts` | D-1 Default, D-12 Dark |
| `order` | `masonry-order.ts` | D-3 Variants, D-15 Keyboard-only |
| `columns` | `masonry-columns.ts` | D-16 Density, D-18 Customization |
| `dynamic` | `masonry-dynamic.ts` | D-17 Composition, D-20 Empty / loading |

## Customization

The `columns` demo uses this rule of the demo stylesheet:

```css
.demo-masonry-dense {
  --z-masonry-gap: var(--z-gap-sm);
  --z-masonry-min-column-width: calc(var(--z-size-24) * 1.5);
}
```


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCard, ZMasonry } from '@zelviora/angular';

@Component({
  selector: 'demo-masonry-basic',
  imports: [ZCard, ZMasonry],
  template: `
    <z-masonry>
      @for (n of notes; track n.id) {
        <z-card [heading]="'Note ' + n.id">
          <p>{{ n.text }}</p>
        </z-card>
      }
    </z-masonry>
  `,
})
export class MasonryBasic {
  // Notes of different lengths give cards of different heights.
  readonly notes = Array.from({ length: 20 }, (_, i) => ({
    id: i + 1,
    text: 'Remember to review the quarterly numbers. '.repeat((i * 7) % 5 + 1),
  }));
}

```

### Case: columns

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZCard, ZMasonry, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-masonry-columns',
  imports: [ZCard, ZMasonry, ZStack],
  template: `
    <z-stack gap="sm">
      <z-masonry class="demo-masonry-dense" (zLayoutChange)="columns.set($event.detail.columns)">
        @for (t of tags; track t; let i = $index) {
          <z-card><p>{{ repeat('#' + t + ' ', (i % 3) + 1) }}</p></z-card>
        }
      </z-masonry>
      <small>{{ columns() ? 'Columns now: ' + columns() : 'Resize the window to change the column count.' }}</small>
    </z-stack>
  `,
})
export class MasonryColumns {
  readonly tags = ['design', 'web', 'tokens', 'a11y', 'react', 'vue', 'angular', 'stencil', 'css', 'i18n', 'rtl', 'dark mode'];
  readonly columns = signal(0);

  repeat(text: string, n: number) {
    return text.repeat(n);
  }
}

```

### Case: dynamic

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZCard, ZMasonry, ZStack } from '@zelviora/angular';

let next = 4;

@Component({
  selector: 'demo-masonry-dynamic',
  imports: [ZButton, ZCard, ZMasonry, ZStack],
  template: `
    <z-stack gap="sm">
      <z-stack orientation="horizontal" gap="sm">
        <z-button (click)="add()">Add card</z-button>
        <z-button variant="outline" tone="neutral" (click)="removeFirst()">Remove first</z-button>
      </z-stack>
      <z-masonry order="balanced" [columns]="3">
        @for (id of items(); track id) {
          <z-card [heading]="'Card ' + id"><p>{{ text(id) }}</p></z-card>
        }
      </z-masonry>
      @if (items().length === 0) {
        <small>No cards.</small>
      }
    </z-stack>
  `,
})
export class MasonryDynamic {
  readonly items = signal([1, 2, 3]);

  add() {
    this.items.update((l) => [...l, next++]);
  }

  removeFirst() {
    this.items.update((l) => l.slice(1));
  }

  text(id: number) {
    return 'Some content. '.repeat(((id * 5) % 6) + 1);
  }
}

```

### Case: order

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCard, ZGrid, ZMasonry, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-masonry-order',
  imports: [ZCard, ZGrid, ZMasonry, ZStack],
  template: `
    <z-grid columns="1 lg:2" gap="lg">
      @for (order of orders; track order) {
        <z-stack gap="sm">
          <strong>order="{{ order }}"</strong>
          <z-masonry [order]="order" [columns]="2">
            @for (n of notes; track n.id) {
              <z-card [heading]="'' + n.id"><p>{{ n.text }}</p></z-card>
            }
          </z-masonry>
        </z-stack>
      }
    </z-grid>
  `,
})
export class MasonryOrder {
  readonly notes = Array.from({ length: 10 }, (_, i) => ({ id: i + 1, text: 'Lorem ipsum dolor sit amet. '.repeat((i * 3) % 4 + 1) }));
  readonly orders = ['dom', 'balanced'] as const;
}

```


================================================================================
# COMPONENT: MENTIONS
================================================================================

## Documentation

# mentions — Angular

Processed requirements of [`<z-mentions>`](../../../../../requirements/04-components/form/mentions.md) for Angular
(`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { TextValueAccessor, ZMentions } from '@zelviora/angular';

@Component({
  selector: 'app-demo',
  imports: [FormsModule, TextValueAccessor, ZMentions],
  template: `<z-mentions name="comment" label="Comment" [options]="users" [(ngModel)]="text"></z-mentions>`,
})
export class Demo {
  text = '';
  users = [{ value: 'anna', label: 'Anna' }];
}
```

## Binding

| Component | Value accessor | Model | Event | Detail |
|---|---|---|---|---|
| `ZMentions` | `TextValueAccessor` (spec §12: `text`) | `[(ngModel)]` / `formControl` (`string`) | `(zInput)` | `{ value }` |

Other events: `(zChange)` (blur), `(zSearch)` (`{ query, trigger }`, debounced 150 ms), `(zSelect)` (cancelable: no insertion), `(zOpenChange)`.
`options`, `triggers` and a `filter` function are properties.

The accessor applies `ValidityValidator`: `required`, `minLength`/`maxLength` (graphemes) reach the Angular control errors.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `mentions-default.ts` | D-1 Default (10 users), D-15 Keyboard-only |
| `variants` | `mentions-variants.ts` | D-3 Variants (`outline`, `filled`), D-5 Sizes |
| `states` | `mentions-states.ts` | D-6 States (loading, empty, disabled, readonly, invalid), D-7 Disabled, D-14 Long content, D-20 Empty / loading |
| `validation` | `mentions-validation.ts` | D-8 Error (required, maxlength) |
| `controlled` | `mentions-controlled.ts` | D-9 Controlled |
| `form` | `mentions-form.ts` | D-10 In form, D-17 Composition (comment box + button) |
| `i18n` | `mentions-i18n.ts` | D-19 i18n ("@an" finds "Ân"), D-11 RTL |
| `customization` | `mentions-customization.ts` | D-18 Customization (`::part(option-highlighted)`) |
| `async` | `mentions-async.ts` | D-21 Async (`zSearch` → `options` after 300 ms) |
| `triggers` | `mentions-triggers.ts` | D-22 Multiple triggers (`@` people, `#` topics) |

D-2 Playground, D-12 Dark, D-13 Brand showcase and D-16 Density come from the docs site switchers; D-4 Tones does not apply.

The `customization` demo uses the `demo-mentions-brand` rule of `demo.css` (same rule as the React README).

## Differences

- The value is plain text (`@label`); keep your own mapping to ids from `zSelect`.
- Pasted text containing a trigger does not open the suggestions.
- Bind boolean and number inputs with `[prop]="…"` (`[required]="true"`).
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: async

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZMentions } from '@zelviora/angular';

const USERS = [
  { value: 'anna', label: 'Anna', description: 'Design' },
  { value: 'ben', label: 'Ben', description: 'Front-end engineer' },
  { value: 'chloe', label: 'Chloe', description: 'Product manager' },
  { value: 'david', label: 'David', description: 'Back-end engineer' },
  { value: 'grace', label: 'Grace', description: 'QA' },
  { value: 'hannah', label: 'Hannah', description: 'User research' },
  { value: 'kevin', label: 'Kevin', description: 'DevOps' },
  { value: 'laura', label: 'Laura', description: 'Data analyst' },
  { value: 'mark', label: 'Mark', description: 'Team lead' },
  { value: 'tina', label: 'Tina', description: 'Customer support' },
];
type User = (typeof USERS)[number];

/** zSearch (debounced) loads matching people after 300 ms; `filter="none"` because the app filters. */
@Component({
  selector: 'demo-mentions-async',
  imports: [ZMentions],
  template: `
    <z-mentions class="demo-narrow" label="Comment (loaded from the server)" filter="none" [options]="options()" [loading]="loading()" (zSearch)="search($event.detail.query)"></z-mentions>
  `,
})
export class MentionsAsync {
  readonly options = signal<User[]>([]);
  readonly loading = signal(false);
  private pending = 0;

  search(query: string) {
    const id = ++this.pending;
    const q = query.toLowerCase();
    this.loading.set(true);
    setTimeout(() => {
      if (id !== this.pending) return;
      this.options.set(USERS.filter((u) => u.value.startsWith(q)));
      this.loading.set(false);
    }, 300);
  }
}

```

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZMentions, ZStack } from '@zelviora/angular';

const USERS = [
  { value: 'anna', label: 'Anna', description: 'Design' },
  { value: 'ben', label: 'Ben', description: 'Front-end engineer' },
  { value: 'chloe', label: 'Chloe', description: 'Product manager' },
  { value: 'david', label: 'David', description: 'Back-end engineer' },
  { value: 'grace', label: 'Grace', description: 'QA' },
  { value: 'hannah', label: 'Hannah', description: 'User research' },
  { value: 'kevin', label: 'Kevin', description: 'DevOps' },
  { value: 'laura', label: 'Laura', description: 'Data analyst' },
  { value: 'mark', label: 'Mark', description: 'Team lead' },
  { value: 'tina', label: 'Tina', description: 'Customer support' },
];

/** The app owns the text (model event zInput); selections and the popup are logged. Selecting "Tina" is cancelled. */
@Component({
  selector: 'demo-mentions-controlled',
  imports: [ZButton, ZMentions, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-mentions
        label="Message"
        [options]="users"
        [value]="value()"
        (zInput)="value.set($event.detail.value)"
        (zSelect)="onSelect($event)"
        (zOpenChange)="add('zOpenChange ' + $event.detail.open + ' (' + $event.detail.reason + ')')"
      ></z-mentions>
      <z-stack orientation="horizontal" gap="sm" [wrap]="true">
        <z-button variant="outline" tone="neutral" (click)="value.set('Please review this, @Mark ')">Set text</z-button>
        <z-button variant="outline" tone="neutral" (click)="value.set('')">Clear</z-button>
      </z-stack>
      <span>Value: {{ value() }}</span>
      <output>{{ log().join(' · ') }}</output>
    </z-stack>
  `,
})
export class MentionsControlled {
  readonly users = USERS;
  readonly value = signal('Hi @Chloe ');
  readonly log = signal<string[]>([]);

  add(line: string) {
    this.log.update((l) => [line, ...l].slice(0, 5));
  }

  onSelect(e: CustomEvent<{ item: { value: string } }>) {
    if (e.detail.item.value === 'tina') {
      e.preventDefault();
      this.add('zSelect tina (cancelled)');
      return;
    }
    this.add(`zSelect ${e.detail.item.value}`);
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZMentions } from '@zelviora/angular';

const USERS = [
  { value: 'anna', label: 'Anna', description: 'Design' },
  { value: 'ben', label: 'Ben', description: 'Front-end engineer' },
  { value: 'chloe', label: 'Chloe', description: 'Product manager' },
  { value: 'david', label: 'David', description: 'Back-end engineer' },
  { value: 'grace', label: 'Grace', description: 'QA' },
  { value: 'hannah', label: 'Hannah', description: 'User research' },
  { value: 'kevin', label: 'Kevin', description: 'DevOps' },
  { value: 'laura', label: 'Laura', description: 'Data analyst' },
  { value: 'mark', label: 'Mark', description: 'Team lead' },
  { value: 'tina', label: 'Tina', description: 'Customer support' },
];

/** Component tokens and the `option-highlighted` part: see the `demo-mentions-brand` rule in README. */
@Component({
  selector: 'demo-mentions-customization',
  imports: [ZMentions],
  template: `
    <z-mentions class="demo-narrow demo-mentions-brand" label="Comment" [options]="users" [rows]="2"></z-mentions>
  `,
})
export class MentionsCustomization {
  readonly users = USERS;
}

```

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { TextValueAccessor, ZMentions, ZStack } from '@zelviora/angular';

const USERS = [
  { value: 'anna', label: 'Anna', description: 'Design' },
  { value: 'ben', label: 'Ben', description: 'Front-end engineer' },
  { value: 'chloe', label: 'Chloe', description: 'Product manager' },
  { value: 'david', label: 'David', description: 'Back-end engineer' },
  { value: 'grace', label: 'Grace', description: 'QA' },
  { value: 'hannah', label: 'Hannah', description: 'User research' },
  { value: 'kevin', label: 'Kevin', description: 'DevOps' },
  { value: 'laura', label: 'Laura', description: 'Data analyst' },
  { value: 'mark', label: 'Mark', description: 'Team lead' },
  { value: 'tina', label: 'Tina', description: 'Customer support' },
];

/**
 * Type @ to mention a teammate: arrows move, Enter or Tab inserts, Escape closes.
 * `[(ngModel)]` through TextValueAccessor (model event `zInput`).
 */
@Component({
  selector: 'demo-mentions-default',
  imports: [FormsModule, TextValueAccessor, ZMentions, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-mentions label="Comment" placeholder="Type @ to mention a teammate" [options]="users" [(ngModel)]="value"></z-mentions>
      <span>Value: {{ value }}</span>
    </z-stack>
  `,
})
export class MentionsDefault {
  readonly users = USERS;
  value = '';
}

```

### Case: form

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZCard, ZField, ZMentions, ZStack } from '@zelviora/angular';

const USERS = [
  { value: 'anna', label: 'Anna', description: 'Design' },
  { value: 'ben', label: 'Ben', description: 'Front-end engineer' },
  { value: 'chloe', label: 'Chloe', description: 'Product manager' },
  { value: 'david', label: 'David', description: 'Back-end engineer' },
  { value: 'grace', label: 'Grace', description: 'QA' },
  { value: 'hannah', label: 'Hannah', description: 'User research' },
  { value: 'kevin', label: 'Kevin', description: 'DevOps' },
  { value: 'laura', label: 'Laura', description: 'Data analyst' },
  { value: 'mark', label: 'Mark', description: 'Team lead' },
  { value: 'tina', label: 'Tina', description: 'Customer support' },
];

/**
 * A comment box: the text with @label mentions is submitted (FormData); required inside a field; reset clears it.
 * FormsModule is not imported, so the form stays native and the element submits its own FormData entry.
 */
@Component({
  selector: 'demo-mentions-form',
  imports: [ZButton, ZCard, ZField, ZMentions, ZStack],
  template: `
    <z-card heading="Discussion" class="demo-narrow">
      <form (submit)="submit($event)">
        <z-stack>
          <z-field label="Comment" hint="Type @ to mention a teammate" [required]="true">
            <z-mentions name="comment" [options]="users" [autoResize]="true" [maxRows]="6" [required]="true"></z-mentions>
          </z-field>
          <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
            <z-button type="submit">Post comment</z-button>
            <z-button type="reset" variant="outline" tone="neutral">Reset</z-button>
          </z-stack>
          @if (sent()) {
            <output>{{ sent() }}</output>
          }
        </z-stack>
      </form>
    </z-card>
  `,
})
export class MentionsForm {
  readonly users = USERS;
  readonly sent = signal('');

  submit(e: Event) {
    e.preventDefault();
    this.sent.set(JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]));
  }
}

```

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGrid, ZMentions } from '@zelviora/angular';

const USERS = [
  { value: 'an', label: 'Ân', description: 'Thiết kế' },
  { value: 'binh', label: 'Bình', description: 'Kỹ sư front-end' },
  { value: 'chi', label: 'Chi', description: 'Quản lý sản phẩm' },
  { value: 'dung', label: 'Dũng', description: 'Kỹ sư back-end' },
  { value: 'giang', label: 'Giang', description: 'Kiểm thử' },
  { value: 'hoa', label: 'Hoa', description: 'Nghiên cứu người dùng' },
  { value: 'khanh', label: 'Khánh', description: 'DevOps' },
  { value: 'lan', label: 'Lan', description: 'Phân tích dữ liệu' },
  { value: 'minh', label: 'Minh', description: 'Trưởng nhóm' },
  { value: 'thao', label: 'Thảo', description: 'Hỗ trợ khách hàng' },
];
const AR_USERS = [
  { value: 'ahmad', label: 'أحمد' },
  { value: 'fatima', label: 'فاطمة' },
  { value: 'omar', label: 'عمر' },
];

/** Typing "@an" finds "Ân" (accents ignored); in RTL the popup follows the caret from the right. */
@Component({
  selector: 'demo-mentions-i18n',
  imports: [ZGrid, ZMentions],
  template: `
    <z-grid columns="1 sm:2" gap="md">
      <z-mentions lang="vi" label="Tiếng Việt" hint='Gõ "@an"' [options]="users" [rows]="2"></z-mentions>
      <div dir="rtl" lang="ar-EG">
        <z-mentions label="العربية" [options]="arUsers" [rows]="2"></z-mentions>
      </div>
    </z-grid>
  `,
})
export class MentionsI18n {
  readonly users = USERS;
  readonly arUsers = AR_USERS;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGrid, ZMentions } from '@zelviora/angular';

const USERS = [
  { value: 'anna', label: 'Anna', description: 'Design' },
  { value: 'ben', label: 'Ben', description: 'Front-end engineer' },
  { value: 'chloe', label: 'Chloe', description: 'Product manager' },
  { value: 'david', label: 'David', description: 'Back-end engineer' },
  { value: 'grace', label: 'Grace', description: 'QA' },
  { value: 'hannah', label: 'Hannah', description: 'User research' },
  { value: 'kevin', label: 'Kevin', description: 'DevOps' },
  { value: 'laura', label: 'Laura', description: 'Data analyst' },
  { value: 'mark', label: 'Mark', description: 'Team lead' },
  { value: 'tina', label: 'Tina', description: 'Customer support' },
];
const LONG = 'Weekly meeting notes:\n1. @Mark sums up the sprint.\n2. @Laura presents the numbers.\n3. @David updates the API.\n4. @Grace reports on testing.\n5. Type @ at the end to see the popup near the bottom.';

/** Empty, filled, loading, no match, disabled, readonly and invalid; a long text scrolls with auto-resize. */
@Component({
  selector: 'demo-mentions-states',
  imports: [ZGrid, ZMentions],
  template: `
    <z-grid columns="1 sm:2" gap="md">
      <z-mentions label="Empty" placeholder="Type @ to mention" [options]="users" [rows]="2"></z-mentions>
      <z-mentions label="With value" value="Thanks @Ben for the review" [options]="users" [rows]="2"></z-mentions>
      <z-mentions label="Loading" hint="Type @ to see the loading state" [options]="[]" [loading]="true" [rows]="2"></z-mentions>
      <z-mentions label="No match" hint="Type @zz" [options]="users" [rows]="2"></z-mentions>
      <z-mentions label="Disabled" value="Thanks @Ben" [options]="users" [disabled]="true" [rows]="2"></z-mentions>
      <z-mentions label="Readonly" value="Thanks @Ben" [options]="users" [readonly]="true" [rows]="2"></z-mentions>
      <z-mentions label="Invalid" value="Thanks @Ben" [options]="users" [invalid]="true" [rows]="2"></z-mentions>
      <z-mentions label="Long content" [options]="users" [autoResize]="true" [maxRows]="4" [value]="long"></z-mentions>
    </z-grid>
  `,
})
export class MentionsStates {
  readonly users = USERS;
  readonly long = LONG;
}

```

### Case: triggers

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZMentions } from '@zelviora/angular';

const OPTIONS = [
  { value: 'anna', label: 'Anna', trigger: '@' },
  { value: 'ben', label: 'Ben', trigger: '@' },
  { value: 'chloe', label: 'Chloe', trigger: '@' },
  { value: 'release', label: 'release', description: 'Release plan', trigger: '#' },
  { value: 'bug', label: 'bug', description: 'Bug report', trigger: '#' },
  { value: 'design', label: 'design', description: 'Design discussion', trigger: '#' },
];

/** "@" lists people, "#" lists topics: each option belongs to one trigger. */
@Component({
  selector: 'demo-mentions-triggers',
  imports: [ZMentions],
  template: `
    <z-mentions class="demo-narrow" label="Post" hint="@ people, # topics" [triggers]="triggers" [options]="options" [rows]="3"></z-mentions>
  `,
})
export class MentionsTriggers {
  readonly triggers = ['@', '#'];
  readonly options = OPTIONS;
}

```

### Case: validation

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZMentions, ZStack } from '@zelviora/angular';

const USERS = [
  { value: 'anna', label: 'Anna', description: 'Design' },
  { value: 'ben', label: 'Ben', description: 'Front-end engineer' },
  { value: 'chloe', label: 'Chloe', description: 'Product manager' },
  { value: 'david', label: 'David', description: 'Back-end engineer' },
  { value: 'grace', label: 'Grace', description: 'QA' },
  { value: 'hannah', label: 'Hannah', description: 'User research' },
  { value: 'kevin', label: 'Kevin', description: 'DevOps' },
  { value: 'laura', label: 'Laura', description: 'Data analyst' },
  { value: 'mark', label: 'Mark', description: 'Team lead' },
  { value: 'tina', label: 'Tina', description: 'Customer support' },
];

/** Required, and a maximum length counted in graphemes (longer input is cut). */
@Component({
  selector: 'demo-mentions-validation',
  imports: [ZButton, ZMentions, ZStack],
  template: `
    <form class="demo-narrow" (submit)="$event.preventDefault()">
      <z-stack>
        <z-mentions name="note" label="Note" [options]="users" [required]="true" [rows]="2"></z-mentions>
        <z-mentions name="short" label="Up to 40 characters" [options]="users" [maxLength]="40" [minLength]="5" [rows]="2" hint="5–40 characters"></z-mentions>
        <z-button type="submit">Submit</z-button>
      </z-stack>
    </form>
  `,
})
export class MentionsValidation {
  readonly users = USERS;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGrid, ZMentions } from '@zelviora/angular';

const USERS = [
  { value: 'anna', label: 'Anna', description: 'Design' },
  { value: 'ben', label: 'Ben', description: 'Front-end engineer' },
  { value: 'chloe', label: 'Chloe', description: 'Product manager' },
  { value: 'david', label: 'David', description: 'Back-end engineer' },
  { value: 'grace', label: 'Grace', description: 'QA' },
  { value: 'hannah', label: 'Hannah', description: 'User research' },
  { value: 'kevin', label: 'Kevin', description: 'DevOps' },
  { value: 'laura', label: 'Laura', description: 'Data analyst' },
  { value: 'mark', label: 'Mark', description: 'Team lead' },
  { value: 'tina', label: 'Tina', description: 'Customer support' },
];

/** Outline and filled boxes in every size. */
@Component({
  selector: 'demo-mentions-variants',
  imports: [ZGrid, ZMentions],
  template: `
    <z-grid columns="1 sm:3" gap="md">
      <z-mentions label="Small" size="sm" [options]="users" [rows]="2"></z-mentions>
      <z-mentions label="Medium" size="md" [options]="users" [rows]="2"></z-mentions>
      <z-mentions label="Large" size="lg" [options]="users" [rows]="2"></z-mentions>
      <z-mentions label="Small filled" size="sm" variant="filled" [options]="users" [rows]="2"></z-mentions>
      <z-mentions label="Medium filled" size="md" variant="filled" [options]="users" [rows]="2"></z-mentions>
      <z-mentions label="Large filled" size="lg" variant="filled" [options]="users" [rows]="2"></z-mentions>
    </z-grid>
  `,
})
export class MentionsVariants {
  readonly users = USERS;
}

```


================================================================================
# COMPONENT: MENUBAR
================================================================================

## Documentation

# menubar — Angular

Processed requirements of [`<z-menubar>` and `<z-menubar-menu>`](../../../../../requirements/04-components/navigation/menubar.md)
for Angular (`@zelviora/angular`, standalone components, Angular >= 21). Menu content uses the `z-menu-*` items of the dropdown menu.

## Usage

```ts
import { Component } from '@angular/core';
import { ZMenuItem, ZMenubar, ZMenubarMenu } from '@zelviora/angular';

@Component({
  selector: 'app-editor-menu',
  imports: [ZMenuItem, ZMenubar, ZMenubarMenu],
  template: `
    <z-menubar label="Editor" (zSelect)="run($event.detail.value)">
      <z-menubar-menu value="file" label="File">
        <z-menu-item value="new">New</z-menu-item>
      </z-menubar-menu>
    </z-menubar>
  `,
})
export class EditorMenu { run(value: string) {} }
```

## Binding

Not a form control: no value accessor, bind the input + the event.

| Component | Input | Event | Detail |
|---|---|---|---|
| `ZMenubar` | `[value]` (open menu, `null` when none) | `(zChange)` | `{ value, reason }` |
| `ZMenuCheckboxItem` | `[checked]` | `(zChange)` | `{ checked, value }` |
| `ZMenuRadioGroup` | `[value]` | `(zChange)` | `{ value }` |

`(zSelect)` (`{ value, item }`, cancelable) bubbles from the items to the menubar.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `menubar-default.ts` | D-1 Default, D-6 States, D-15 Keyboard-only, D-17 Composition (checkbox/radio, submenu, kbd) |
| `controlled` | `menubar-controlled.ts` | D-9 Controlled, D-7 Disabled, D-11 RTL, D-19 i18n |
| `sizes` | `menubar-sizes.ts` | D-5 Sizes, D-16 Density |
| `overflow` | `menubar-overflow.ts` | D-21 Overflow (`overflow="scroll"` and `overflow="menu"`) |

## Differences

- `zChange` of the menubar bubbles: a checkbox / radio item `zChange` inside it also reaches a listener on the menubar;
  check `e.target` when listening there.
- Boolean and number props are bound with `[prop]="…"`, so the value reaches the element with its type.
- `overflow="menu"` moves the menus that do not fit into a "…" menu at the end of the bar (default `scroll`: the bar scrolls). The button is named by the
  `menubar.more` message.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZMenuItem, ZMenubar, ZMenubarMenu, ZStack } from '@zelviora/angular';

/** `[value]` (open menu) + `(zOpenChange)` driven by the app, a disabled menu and a right-to-left menubar. */
@Component({
  selector: 'demo-menubar-controlled',
  imports: [ZButton, ZMenuItem, ZMenubar, ZMenubarMenu, ZStack],
  template: `
    <z-stack gap="md">
      <z-menubar label="Document" [value]="value()" (zOpenChange)="onChange($event)">
        <z-menubar-menu value="file" label="File">
          <z-menu-item value="save">Save</z-menu-item>
          <z-menu-item value="export">Export</z-menu-item>
        </z-menubar-menu>
        <z-menubar-menu value="share" label="Share" [disabled]="true">
          <z-menu-item value="link">Copy link</z-menu-item>
        </z-menubar-menu>
        <z-menubar-menu value="help" label="Help">
          <z-menu-item value="docs">Documentation</z-menu-item>
        </z-menubar-menu>
      </z-menubar>
      <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="md">
        <z-button variant="outline" tone="neutral" (click)="value.set('help')">Open “Help”</z-button>
        <span>Open menu: {{ value() ?? 'none' }}</span>
      </z-stack>
      <z-menubar label="المحرر" dir="rtl" lang="ar">
        <z-menubar-menu value="file" label="ملف">
          <z-menu-item value="new">جديد</z-menu-item>
          <z-menu-item value="open">فتح</z-menu-item>
        </z-menubar-menu>
        <z-menubar-menu value="edit" label="تحرير">
          <z-menu-item value="undo">تراجع</z-menu-item>
        </z-menubar-menu>
      </z-menubar>
    </z-stack>
  `,
})
export class MenubarControlled {
  readonly value = signal<string | null>(null);

  onChange(e: CustomEvent<{ value: string | null }>) {
    if (e.target === e.currentTarget) this.value.set(e.detail.value);
  }
}

```

### Case: default

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import {
  ZMenuCheckboxItem, ZMenuItem, ZMenuRadioGroup, ZMenuRadioItem, ZMenuSeparator, ZMenuSub, ZMenubar, ZMenubarMenu, ZStack,
} from '@zelviora/angular';

/** File / Edit / View with shortcuts, a submenu, checkbox and radio items. One Tab stop; arrows move between menus. */
@Component({
  selector: 'demo-menubar-default',
  imports: [ZMenuCheckboxItem, ZMenuItem, ZMenuRadioGroup, ZMenuRadioItem, ZMenuSeparator, ZMenuSub, ZMenubar, ZMenubarMenu, ZStack],
  template: `
    <z-stack gap="sm">
      <z-menubar label="Editor" (zSelect)="last.set($event.detail.value)">
        <z-menubar-menu value="file" label="File">
          <z-menu-item value="new">New<kbd slot="shortcut">⌘N</kbd></z-menu-item>
          <z-menu-item value="open">Open…<kbd slot="shortcut">⌘O</kbd></z-menu-item>
          <z-menu-sub>
            <z-menu-item slot="trigger">Open recent</z-menu-item>
            <z-menu-item value="recent-a">notes.txt</z-menu-item>
            <z-menu-item value="recent-b">plan.md</z-menu-item>
          </z-menu-sub>
          <z-menu-separator></z-menu-separator>
          <z-menu-item value="print" [disabled]="true">Print…</z-menu-item>
        </z-menubar-menu>
        <z-menubar-menu value="edit" label="Edit">
          <z-menu-item value="undo">Undo<kbd slot="shortcut">⌘Z</kbd></z-menu-item>
          <z-menu-item value="redo">Redo<kbd slot="shortcut">⇧⌘Z</kbd></z-menu-item>
          <z-menu-separator></z-menu-separator>
          <z-menu-item value="cut">Cut</z-menu-item>
          <z-menu-item value="copy">Copy</z-menu-item>
          <z-menu-item value="paste">Paste</z-menu-item>
        </z-menubar-menu>
        <z-menubar-menu value="view" label="View">
          <z-menu-checkbox-item [checked]="ruler()" (zChange)="ruler.set($event.detail.checked)">Ruler</z-menu-checkbox-item>
          <z-menu-separator></z-menu-separator>
          <z-menu-radio-group [value]="zoom()" (zChange)="zoom.set($event.detail.value)">
            <z-menu-radio-item value="100">100%</z-menu-radio-item>
            <z-menu-radio-item value="200">200%</z-menu-radio-item>
          </z-menu-radio-group>
        </z-menubar-menu>
      </z-menubar>
      <span>Last action: {{ last() || 'none' }} · ruler {{ ruler() ? 'on' : 'off' }} · zoom {{ zoom() }}%</span>
    </z-stack>
  `,
})
export class MenubarDefault {
  readonly last = signal('');
  readonly ruler = signal(true);
  readonly zoom = signal('100');
}

```

### Case: overflow

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZMenuItem, ZMenubar, ZMenubarMenu, ZStack } from '@zelviora/angular';

/** Eight menus in a narrow column: `scroll` scrolls the bar, `menu` moves the menus that do not fit into a "…" menu. */
@Component({
  selector: 'demo-menubar-overflow',
  imports: [ZMenuItem, ZMenubar, ZMenubarMenu, ZStack],
  template: `
    <z-stack orientation="vertical" gap="lg" class="demo-narrow">
      @for (overflow of modes; track overflow) {
        <z-menubar [label]="'Editor (' + overflow + ')'" [overflow]="overflow">
          @for (m of menus; track m) {
            <z-menubar-menu [value]="m.toLowerCase()" [label]="m">
              <z-menu-item [value]="m.toLowerCase() + '-a'">{{ m }} command A</z-menu-item>
              <z-menu-item [value]="m.toLowerCase() + '-b'">{{ m }} command B</z-menu-item>
            </z-menubar-menu>
          }
        </z-menubar>
      }
    </z-stack>
  `,
})
export class MenubarOverflow {
  readonly menus = ['File', 'Edit', 'View', 'Insert', 'Format', 'Tools', 'Window', 'Help'];
  readonly modes = ['scroll', 'menu'] as const;
}

```

### Case: sizes

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZMenuItem, ZMenubar, ZMenubarMenu, ZStack } from '@zelviora/angular';

/** Sizes sm, md and lg (height and trigger padding follow the control tokens). */
@Component({
  selector: 'demo-menubar-sizes',
  imports: [ZMenuItem, ZMenubar, ZMenubarMenu, ZStack],
  template: `
    <z-stack gap="md">
      @for (size of sizes; track size) {
        <z-menubar [label]="'Menubar ' + size" [size]="size">
          <z-menubar-menu value="file" label="File">
            <z-menu-item value="new">New</z-menu-item>
          </z-menubar-menu>
          <z-menubar-menu value="edit" label="Edit">
            <z-menu-item value="undo">Undo</z-menu-item>
          </z-menubar-menu>
        </z-menubar>
      }
    </z-stack>
  `,
})
export class MenubarSizes {
  readonly sizes = ['sm', 'md', 'lg'] as const;
}

```


================================================================================
# COMPONENT: MULTI-SELECT
================================================================================

## Documentation

# multi-select — Angular

Processed requirements of [`<z-multi-select>` (options declared with `<z-select-option>` / `<z-select-group>`)](../../../../../requirements/04-components/form/multi-select.md)
for Angular (`@zelviora/angular`).

## Usage

```html
<z-multi-select name="skills" label="Skills" [(ngModel)]="skills">
  <z-select-option value="ts">TypeScript</z-select-option>
  <z-select-option value="css">CSS</z-select-option>
</z-multi-select>
```

## Binding

| Value accessor | Model | Event | Detail |
|---|---|---|---|
| `SelectValueAccessor` | `[(ngModel)]` / `formControl` (`string[]` (order chosen)) | `(zChange)` | `{ value, option, reason }` |
| — | `[open]` (no two-way binding, D-031) | `(zOpenChange)` | `{ open, reason }` |

## Events

`(zSearch)`, `(zChange)`, `(zRemove)`, `(zOpenChange)`, `(zBeforeOpen)`, `(zBeforeClose)`, `(zClear)`, `(zLoadMore)`, `(zAfterOpen)`, `(zAfterClose)`.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `multi-select-default.ts` | D-1 Default, D-24 Groups, D-7 Disabled (option), clear all |
| `limits` | `multi-select-limits.ts` | D-21 `max-count=3`, `min-count=2`, D-10 In form, D-8 Error |
| `tags` | `multi-select-tags.ts` | D-22 `maxTagCount` responsive in a narrow container, fixed count, D-25 Long labels |
| `async` | `multi-select-async.ts` | D-23 Async (search event, loading) |
| `large` | `multi-select-large.ts` | D-26 Virtual (5 000 options) |

## Differences

- Boolean, number, array and function props are bound with `[prop]="…"` so the value reaches the element with its type.
- Tags are rendered by the multi-select itself (parts `tag`, `tag-label`, `tag-remove`), not by the tag component yet.
- `virtual` (`auto` above 200 options after filtering, `on`, `off`) renders only the options in view.
- The search text (`inputValue`) is not a controlled / two-way value: listen to the search event.
- Form reset does not emit events: reset the bound value yourself.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: async

#### Angular
```typescript
import { Component, type OnDestroy, computed, signal } from '@angular/core';
import { ZMultiSelect, ZStack } from '@zelviora/angular';

/** Shape of the `options` property (ZSelectOptionData of the core package). */
type Opt = { value: string; label: string };

const STREETS = ['Main Street', 'Oak Avenue', 'Maple Drive', 'Park Lane', 'Cedar Road', 'Elm Court'];
/** Fixed fake dataset: 120 addresses. */
const DATA: Opt[] = Array.from({ length: 120 }, (_, i) => ({ value: `a${i + 1}`, label: `${i + 1} ${STREETS[i % STREETS.length]}` }));
const PAGE = 20;
const fold = (s: string) => s.normalize('NFD').replace(/\p{Mn}/gu, '').toLowerCase();
const search = (q: string) => DATA.filter((o) => fold(o.label).includes(fold(q)));

/** The app filters (filter="none"): debounced zSearch, loading while waiting; chosen values stay as tags. */
@Component({
  selector: 'demo-multi-select-async',
  imports: [ZMultiSelect, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-multi-select label="Delivery address" filter="none" [maxTagCount]="4" [loading]="loading()" [options]="shown()" (zSearch)="onSearch($event.detail.query)"></z-multi-select>
    </z-stack>
  `,
})
export class MultiSelectAsync implements OnDestroy {
  readonly query = signal('');
  readonly loading = signal(false);
  readonly shown = computed(() => search(this.query()).slice(0, PAGE));
  private timer?: ReturnType<typeof setTimeout>;

  onSearch(q: string) {
    clearTimeout(this.timer);
    this.loading.set(true);
    this.timer = setTimeout(() => { this.query.set(q); this.loading.set(false); }, 300);
  }

  ngOnDestroy() {
    clearTimeout(this.timer);
  }
}

```

### Case: default

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZMultiSelect, ZSelectGroup, ZSelectOption, ZStack } from '@zelviora/angular';

/** `selected` options give the initial tags; groups, a disabled option, clear all; the value keeps the order chosen. */
@Component({
  selector: 'demo-multi-select-default',
  imports: [ZMultiSelect, ZSelectGroup, ZSelectOption, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-multi-select label="Skills" placeholder="Type to search" [clearable]="true" [maxTagCount]="10" (zChange)="value.set($event.detail.value)">
        <z-select-group label="Frontend">
          <z-select-option value="ts" [selected]="true">TypeScript</z-select-option>
          <z-select-option value="css" [selected]="true">CSS</z-select-option>
          <z-select-option value="react">React</z-select-option>
        </z-select-group>
        <z-select-group label="Backend">
          <z-select-option value="go">Go</z-select-option>
          <z-select-option value="node">Node.js</z-select-option>
          <z-select-option value="cobol" [disabled]="true">COBOL</z-select-option>
        </z-select-group>
      </z-multi-select>
      <span>Value: {{ value().length ? value().join(', ') : 'none' }}</span>
    </z-stack>
  `,
})
export class MultiSelectDefault {
  readonly value = signal<string[]>(['ts', 'css']);
}

```

### Case: large

#### Angular
```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SelectValueAccessor, ZMultiSelect, ZStack } from '@zelviora/angular';

/** 5 000 options as data: the list is virtual (`virtual="auto"` above 200 options); chosen options become tags. */
@Component({
  selector: 'demo-multi-select-large',
  imports: [FormsModule, SelectValueAccessor, ZMultiSelect, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-multi-select label="Products" placeholder="Type a number" [options]="products" [clearable]="true" [(ngModel)]="value"></z-multi-select>
      <span>Value: {{ value.length ? value.join(', ') : 'none' }}</span>
    </z-stack>
  `,
})
export class MultiSelectLarge {
  readonly products = Array.from({ length: 5000 }, (_, i) => ({ value: `sku-${i + 1}`, label: `Product ${i + 1}` }));
  value: string[] = [];
}

```

### Case: limits

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZMultiSelect, ZSelectOption, ZStack } from '@zelviora/angular';

const PEOPLE = ['Anna', 'Ben', 'Chloe', 'David', 'Emma', 'Frank'];

/**
 * max-count=3 disables the other options; min-count=2 is an error on submit; one FormData entry per value.
 * FormsModule is not imported, so the form stays native and the element submits its own FormData entries.
 */
@Component({
  selector: 'demo-multi-select-limits',
  imports: [ZButton, ZMultiSelect, ZSelectOption, ZStack],
  template: `
    <form class="demo-narrow" (submit)="submit($event)">
      <z-stack>
        <z-multi-select name="team" label="Team members" hint="2 to 3 people" [maxCount]="3" [minCount]="2" [maxTagCount]="3">
          @for (p of people; track p) {
            <z-select-option [value]="p.toLowerCase()">{{ p }}</z-select-option>
          }
        </z-multi-select>
        <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
          <z-button type="submit">Submit</z-button>
          <z-button type="reset" variant="outline" tone="neutral">Reset</z-button>
        </z-stack>
        @if (sent()) {
          <output>{{ sent() }}</output>
        }
      </z-stack>
    </form>
  `,
})
export class MultiSelectLimits {
  readonly people = PEOPLE;
  readonly sent = signal('');

  submit(e: Event) {
    e.preventDefault();
    this.sent.set(JSON.stringify(new FormData(e.currentTarget as HTMLFormElement).getAll('team')));
  }
}

```

### Case: tags

#### Angular
```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SelectValueAccessor, ZMultiSelect, ZSelectOption, ZStack } from '@zelviora/angular';

const TOPICS = [
  'Designing large-scale distributed systems',
  'Test automation',
  'Accessibility',
  'Internationalization',
  'Web performance',
  'Application security',
];

/** Responsive tag count in a narrow column ("+N" for the rest), a fixed max-tag-count, long labels cut with an ellipsis. */
@Component({
  selector: 'demo-multi-select-tags',
  imports: [FormsModule, SelectValueAccessor, ZMultiSelect, ZSelectOption, ZStack],
  template: `
    <z-stack class="demo-tight">
      <z-multi-select label="Responsive" [(ngModel)]="value">
        @for (t of topics; track t; let i = $index) {
          <z-select-option [value]="'t' + i">{{ t }}</z-select-option>
        }
      </z-multi-select>
      <z-multi-select label="max-tag-count = 2" [maxTagCount]="2" [(ngModel)]="value">
        @for (t of topics; track t; let i = $index) {
          <z-select-option [value]="'t' + i">{{ t }}</z-select-option>
        }
      </z-multi-select>
    </z-stack>
  `,
})
export class MultiSelectTags {
  readonly topics = TOPICS;
  value: string[] = TOPICS.map((_, i) => `t${i}`);
}

```


================================================================================
# COMPONENT: NAVIGATION-MENU
================================================================================

## Documentation

# navigation-menu — Angular

Processed requirements of [`<z-navigation-menu>` and its items, links and panels](../../../../../requirements/04-components/navigation/navigation-menu.md)
for Angular (`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component, input } from '@angular/core';
import { ZNavigationMenu, ZNavigationMenuContent, ZNavigationMenuItem, ZNavigationMenuLink } from '@zelviora/angular';

@Component({
  selector: 'app-header-nav',
  imports: [ZNavigationMenu, ZNavigationMenuContent, ZNavigationMenuItem, ZNavigationMenuLink],
  template: `
    <z-navigation-menu label="Main" [currentHref]="url()">
      <z-navigation-menu-item value="products" label="Products">
        <z-navigation-menu-content>
          <z-navigation-menu-link href="/products/shirts">Shirts</z-navigation-menu-link>
        </z-navigation-menu-content>
      </z-navigation-menu-item>
      <z-navigation-menu-item value="contact">
        <z-navigation-menu-link href="/contact">Contact</z-navigation-menu-link>
      </z-navigation-menu-item>
    </z-navigation-menu>
  `,
})
export class HeaderNav { readonly url = input(''); }
```

The panel links are light DOM: a router link (`<a routerLink>`) can be used inside `ZNavigationMenuContent` directly.

## Binding

Not a form control: no value accessor, bind the input + the event.

| Component | Input | Event | Detail |
|---|---|---|---|
| `ZNavigationMenu` | `[value]` (open panel, `null` when none) | `(zOpenChange)` | `{ value, open, reason }` |

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `navigation-menu-default.ts` | D-1 Default, D-6 States (active link), D-14 Long content (mega menu), D-15 Keyboard-only |
| `controlled` | `navigation-menu-controlled.ts` | D-9 Controlled, D-21 Hover disabled |
| `vertical` | `navigation-menu-vertical.ts` | D-22 Vertical, D-11 RTL, D-19 i18n |
| `spa-routing` | `navigation-menu-spa-routing.ts` | D-23 SPA routing (app links at the top level, panel closes on select) |

## Differences

- Panels do not turn into a drawer on narrow screens (spec ⚠️): use a sidebar or drawer for mobile navigation.
- Boolean and number props are bound with `[prop]="…"`, so the value reaches the element with its type.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZNavigationMenu, ZNavigationMenuContent, ZNavigationMenuItem, ZNavigationMenuLink, ZStack } from '@zelviora/angular';

/** `[value]` + `(zOpenChange)` driven by the app, click-only panels (`disableHover`) and `currentHref` following a route. */
@Component({
  selector: 'demo-navigation-menu-controlled',
  imports: [ZButton, ZNavigationMenu, ZNavigationMenuContent, ZNavigationMenuItem, ZNavigationMenuLink, ZStack],
  template: `
    <z-stack gap="md">
      <z-navigation-menu label="Company" [value]="value()" [disableHover]="true" [currentHref]="page()" (zOpenChange)="value.set($event.detail.value)">
        <z-navigation-menu-item value="about" label="About">
          <z-navigation-menu-content>
            <z-navigation-menu-link href="#navigation-menu-team">Team</z-navigation-menu-link>
            <z-navigation-menu-link href="#navigation-menu-careers">Careers</z-navigation-menu-link>
          </z-navigation-menu-content>
        </z-navigation-menu-item>
        <z-navigation-menu-item value="news" label="News">
          <z-navigation-menu-content>
            <z-navigation-menu-link href="#navigation-menu-press">Press</z-navigation-menu-link>
            <z-navigation-menu-link href="#navigation-menu-events">Events</z-navigation-menu-link>
          </z-navigation-menu-content>
        </z-navigation-menu-item>
      </z-navigation-menu>
      <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="md">
        <z-button variant="outline" tone="neutral" (click)="value.set('news')">Open “News”</z-button>
        <z-button variant="ghost" tone="neutral" (click)="changeRoute()">Change route</z-button>
        <span>Open panel: {{ value() ?? 'none' }}</span>
      </z-stack>
    </z-stack>
  `,
})
export class NavigationMenuControlled {
  readonly value = signal<string | null>(null);
  readonly page = signal('#navigation-menu-team');

  changeRoute() {
    this.page.set(this.page().endsWith('team') ? '#navigation-menu-careers' : '#navigation-menu-team');
  }
}

```

### Case: default

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZGrid, ZNavigationMenu, ZNavigationMenuContent, ZNavigationMenuItem, ZNavigationMenuLink, ZStack } from '@zelviora/angular';

/** Two panels (one a multi-column mega menu) and a plain link; hover or click opens, Tab walks into the open panel. */
@Component({
  selector: 'demo-navigation-menu-default',
  imports: [ZGrid, ZNavigationMenu, ZNavigationMenuContent, ZNavigationMenuItem, ZNavigationMenuLink, ZStack],
  template: `
    <z-stack gap="sm">
      <z-navigation-menu label="Main" currentHref="#navigation-menu-pricing" (zOpenChange)="open.set($event.detail.value)">
        <z-navigation-menu-item value="products" label="Products">
          <z-navigation-menu-content>
            <z-grid columns="2" gap="xs">
              <z-navigation-menu-link href="#navigation-menu-analytics">Analytics</z-navigation-menu-link>
              <z-navigation-menu-link href="#navigation-menu-automation">Automation</z-navigation-menu-link>
              <z-navigation-menu-link href="#navigation-menu-reports">Reports</z-navigation-menu-link>
              <z-navigation-menu-link href="#navigation-menu-integrations">Integrations</z-navigation-menu-link>
              <z-navigation-menu-link href="#navigation-menu-security">Security</z-navigation-menu-link>
              <z-navigation-menu-link href="#navigation-menu-api">API</z-navigation-menu-link>
            </z-grid>
          </z-navigation-menu-content>
        </z-navigation-menu-item>
        <z-navigation-menu-item value="resources" label="Resources">
          <z-navigation-menu-content>
            <z-navigation-menu-link href="#navigation-menu-docs">Documentation</z-navigation-menu-link>
            <z-navigation-menu-link href="#navigation-menu-blog">Blog</z-navigation-menu-link>
            <z-navigation-menu-link href="#navigation-menu-pricing">Pricing</z-navigation-menu-link>
          </z-navigation-menu-content>
        </z-navigation-menu-item>
        <z-navigation-menu-item value="contact">
          <z-navigation-menu-link href="#navigation-menu-contact">Contact</z-navigation-menu-link>
        </z-navigation-menu-item>
      </z-navigation-menu>
      <span>Open panel: {{ open() ?? 'none' }} · current page: Pricing</span>
    </z-stack>
  `,
})
export class NavigationMenuDefault {
  readonly open = signal<string | null>(null);
}

```

### Case: spa-routing

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZNavigationMenu, ZNavigationMenuContent, ZNavigationMenuItem, ZNavigationMenuLink } from '@zelviora/angular';

// SPA routing (ADR-026): one (zNavigate) listener routes with the app router; Ctrl/⌘-click still opens a new tab.
@Component({
  selector: 'demo-navigation-menu-spa-routing',
  imports: [ZNavigationMenu, ZNavigationMenuContent, ZNavigationMenuItem, ZNavigationMenuLink],
  template: `
    <z-navigation-menu label="Main" [currentHref]="route" (zNavigate)="navigate($event)">
      <z-navigation-menu-item value="products" label="Products">
        <z-navigation-menu-content>
          <z-navigation-menu-link href="#/products/analytics">Analytics</z-navigation-menu-link>
          <z-navigation-menu-link href="#/products/billing">Billing</z-navigation-menu-link>
        </z-navigation-menu-content>
      </z-navigation-menu-item>
      <z-navigation-menu-item value="pricing"><a href="#/pricing" (click)="appLink($event)">Pricing</a></z-navigation-menu-item>
      <z-navigation-menu-item value="docs"><a href="#/docs" (click)="appLink($event)">Docs</a></z-navigation-menu-item>
    </z-navigation-menu>
    <p aria-live="polite">Current route: <code>{{ route }}</code></p>
  `,
})
export class NavigationMenuSpaRouting {
  route = '#/pricing';

  /** One zNavigate listener calls the app router (stand-in for `Router.navigateByUrl`). */
  navigate(e: Event): void {
    const ev = e as CustomEvent<{ href: string }>;
    ev.preventDefault();
    this.route = ev.detail.href; // this.router.navigateByUrl(...)
  }

  /** Stand-in for `<a routerLink>`: an `<a href>` that routes on a plain click. */
  appLink(e: MouseEvent): void {
    if (e.ctrlKey || e.metaKey || e.shiftKey || e.button !== 0) return;
    e.preventDefault();
    this.route = (e.currentTarget as HTMLAnchorElement).getAttribute('href')!;
  }
}

```

### Case: vertical

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZNavigationMenu, ZNavigationMenuContent, ZNavigationMenuItem, ZNavigationMenuLink, ZStack } from '@zelviora/angular';

/** Vertical orientation (panels open at the inline end; ArrowUp / ArrowDown between items) and right-to-left. */
@Component({
  selector: 'demo-navigation-menu-vertical',
  imports: [ZNavigationMenu, ZNavigationMenuContent, ZNavigationMenuItem, ZNavigationMenuLink, ZStack],
  template: `
    <z-stack orientation="horizontal" [wrap]="true" gap="lg">
      <z-navigation-menu label="Sections" orientation="vertical">
        <z-navigation-menu-item value="guides" label="Guides">
          <z-navigation-menu-content>
            <z-navigation-menu-link href="#navigation-menu-install">Install</z-navigation-menu-link>
            <z-navigation-menu-link href="#navigation-menu-theming">Theming</z-navigation-menu-link>
          </z-navigation-menu-content>
        </z-navigation-menu-item>
        <z-navigation-menu-item value="faq">
          <z-navigation-menu-link href="#navigation-menu-faq">FAQ</z-navigation-menu-link>
        </z-navigation-menu-item>
      </z-navigation-menu>
      <z-navigation-menu label="رئيسي" dir="rtl" lang="ar">
        <z-navigation-menu-item value="products" label="المنتجات">
          <z-navigation-menu-content>
            <z-navigation-menu-link href="#navigation-menu-a">تحليلات</z-navigation-menu-link>
            <z-navigation-menu-link href="#navigation-menu-b">تقارير</z-navigation-menu-link>
          </z-navigation-menu-content>
        </z-navigation-menu-item>
        <z-navigation-menu-item value="contact">
          <z-navigation-menu-link href="#navigation-menu-c">اتصل بنا</z-navigation-menu-link>
        </z-navigation-menu-item>
      </z-navigation-menu>
    </z-stack>
  `,
})
export class NavigationMenuVertical {}

```


================================================================================
# COMPONENT: NUMBER-INPUT
================================================================================

## Documentation

# number-input — Angular

Processed requirements of [`<z-number-input>`](../../../../../requirements/04-components/form/number-input.md) for Angular (`@zelviora/angular`).

## Usage

```ts
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { NumericValueAccessor, ZNumberInput } from '@zelviora/angular';

@Component({
  selector: 'app-qty',
  imports: [FormsModule, NumericValueAccessor, ZNumberInput],
  template: `<z-number-input label="Quantity" name="qty" [min]="1" [max]="99" [(ngModel)]="qty"></z-number-input>`,
})
export class Qty { qty: number | null = 1; }
```

The value is a **number** (`null` when empty). Display and parsing follow the locale through `Intl.NumberFormat`
(`formatOptions` for currency, percent, unit); while focused the text is easy to edit (no grouping). Percent: the value is
a ratio (`0.5` shows `50%`). The form always receives the canonical string (`"1234.5"`). Values beyond
`Number.MAX_SAFE_INTEGER` are `badInput`: use `z-input` with `inputmode="numeric"` for identifiers.

## Binding

| Value accessor / prop | Model event |
|---|---|
| `NumericValueAccessor`, `[(ngModel)]` / `formControl` (`number | null`) | `zInput` |

Form reset restores the default value without events; reset your state yourself.

## Events

`zInput` (typing text that parses or is empty, arrows, buttons; detail `{ value, text }`), `zChange` (blur, Enter, arrow key, release of a stepper button).

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `number-input-default.ts` | D-1 Default, D-5 Sizes (suffix unit) |
| `formats` | `number-input-formats.ts` | D-19 i18n, D-21 Currency, D-22 Percent, D-14 Long content |
| `error` | `number-input-error.ts` | D-8 Error (rangeUnderflow, badInput) |
| `controlled` | `number-input-controlled.ts` | D-9 Controlled |
| `form` | `number-input-form.ts` | D-10 In form (FormData "1234.5") |
| `i18n` | `number-input-i18n.ts` | D-19 i18n |

Not yet covered: D-11 RTL (Arabic-Indic digits), D-15 keyboard-only, D-17 composition with a unit select, D-23 decimal step (covered by tests E-1).


## Examples & Implementation

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { NumericValueAccessor, ZNumberInput, ZStack } from '@zelviora/angular';

/** ngModel holds a number (or null when empty) through NumericValueAccessor; zChange reports committed values. */
@Component({
  selector: 'demo-number-input-controlled',
  imports: [FormsModule, NumericValueAccessor, ZNumberInput, ZStack],
  template: `
    <z-stack gap="sm" class="demo-narrow">
      <z-number-input
        label="Tickets"
        [min]="0"
        [max]="10"
        [ngModel]="value()"
        (ngModelChange)="value.set($event)"
        (zChange)="committed.set($event.detail.value)"
      ></z-number-input>
      <small>Value: {{ value() ?? '—' }} · Last change: {{ committed() ?? '—' }}</small>
    </z-stack>
  `,
})
export class NumberInputControlled {
  readonly value = signal<number | null>(2);
  readonly committed = signal<number | null>(2);
}

```

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZNumberInput, ZStack } from '@zelviora/angular';

/** Quantity with min/max and a unit in the suffix slot; arrows, PageUp/PageDown, Home/End and the buttons step the value. */
@Component({
  selector: 'demo-number-input-default',
  imports: [ZNumberInput, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-number-input label="Quantity" name="qty" [min]="1" [max]="99" [value]="1" hint="1 to 99"></z-number-input>
      <z-number-input label="Weight" name="weight" [min]="0" [step]="0.1" [value]="0.3">
        <span slot="suffix">kg</span>
      </z-number-input>
    </z-stack>
  `,
})
export class NumberInputDefault {}

```

### Case: error

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZNumberInput, ZStack } from '@zelviora/angular';

/** Validation after blur or submit: required, range (clamp-behavior none keeps the typed value), text that does not parse. */
@Component({
  selector: 'demo-number-input-error',
  imports: [ZButton, ZNumberInput, ZStack],
  template: `
    <form class="demo-narrow" (submit)="$event.preventDefault()">
      <z-stack>
        <z-number-input label="Guests" name="guests" [required]="true" hint="Type a number, clear it and leave the field"></z-number-input>
        <z-number-input label="Deposit" name="deposit" [min]="1000" clampBehavior="none" [value]="500" hint="At least 1,000"></z-number-input>
        <z-number-input label="Rooms" name="rooms" [invalid]="true" [value]="3" hint="Forced error display"></z-number-input>
        <z-button type="submit">Book</z-button>
      </z-stack>
    </form>
  `,
})
export class NumberInputError {}

```

### Case: form

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZNumberInput, ZStack } from '@zelviora/angular';

/** The form always receives the canonical string ("1234.5"), whatever the display locale. */
@Component({
  selector: 'demo-number-input-form',
  imports: [ZButton, ZNumberInput, ZStack],
  template: `
    <form class="demo-narrow" (submit)="submit($event)">
      <z-stack>
        <z-number-input label="Amount" name="amount" locale="de-DE" [step]="0.1" [value]="1234.5"></z-number-input>
        <z-number-input label="Rate" name="rate" [formatOptions]="percent" [value]="0.5"></z-number-input>
        <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
          <z-button type="submit">Submit</z-button>
          <z-button type="reset" variant="outline" tone="neutral">Reset</z-button>
        </z-stack>
        @if (sent()) {
          <output>{{ sent() }}</output>
        }
      </z-stack>
    </form>
  `,
})
export class NumberInputForm {
  readonly percent: Intl.NumberFormatOptions = { style: 'percent' };
  readonly sent = signal('');

  submit(e: Event) {
    e.preventDefault();
    this.sent.set(JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]));
  }
}

```

### Case: formats

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGrid, ZNumberInput } from '@zelviora/angular';

/** Intl formats: currency in de-DE and en-US, percent (the value is a ratio: 0.15 shows 15%), unit. Focus shows plain digits. */
@Component({
  selector: 'demo-number-input-formats',
  imports: [ZGrid, ZNumberInput],
  template: `
    <z-grid columns="1 sm:2">
      <z-number-input label="Price (de-DE)" locale="de-DE" [formatOptions]="eur" [min]="0" [step]="0.01" [value]="1250"></z-number-input>
      <z-number-input label="Price (en-US)" locale="en-US" [formatOptions]="usd" [min]="0" [step]="0.01" [value]="1234.5"></z-number-input>
      <z-number-input label="Discount" [formatOptions]="percent" [min]="0" [max]="1" [value]="0.15"></z-number-input>
      <z-number-input label="Distance" [formatOptions]="km" [min]="0" [step]="0.001" [value]="42.195"></z-number-input>
    </z-grid>
  `,
})
export class NumberInputFormats {
  readonly eur: Intl.NumberFormatOptions = { style: 'currency', currency: 'EUR' };
  readonly usd: Intl.NumberFormatOptions = { style: 'currency', currency: 'USD' };
  readonly percent: Intl.NumberFormatOptions = { style: 'percent' };
  readonly km: Intl.NumberFormatOptions = { style: 'unit', unit: 'kilometer', maximumFractionDigits: 3 };
}

```

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZConfigProvider, ZNumberInput, ZStack } from '@zelviora/angular';

/** With locale `vi` the number uses "." for thousands and "," for decimals; the required error is Vietnamese. */
@Component({
  selector: 'demo-number-input-i18n',
  imports: [ZButton, ZConfigProvider, ZNumberInput, ZStack],
  template: `
    <z-config-provider locale="vi">
      <form class="demo-narrow" (submit)="$event.preventDefault()">
        <z-stack>
          <z-number-input label="Giá" [formatOptions]="vnd" [min]="0" [step]="1000" [value]="1250000"></z-number-input>
          <z-number-input label="Số lượng" name="qty" [required]="true" hint="Xoá số rồi bấm Đặt hàng"></z-number-input>
          <z-button type="submit">Đặt hàng</z-button>
        </z-stack>
      </form>
    </z-config-provider>
  `,
})
export class NumberInputI18n {
  readonly vnd: Intl.NumberFormatOptions = { style: 'currency', currency: 'VND' };
}

```

### Case: layout

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZNumberInput, ZStack } from '@zelviora/angular';

/** Stepper button layouts: stacked (default), horizontal, vertical, and blank. */
@Component({
  selector: 'demo-number-input-layout',
  imports: [ZNumberInput, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-number-input label="Stacked (Default)" buttonLayout="stacked" [value]="5" hint="Up and down buttons on the right"></z-number-input>
      <z-number-input label="Horizontal" buttonLayout="horizontal" [value]="10" hint="Decrement on left, increment on right"></z-number-input>
      <z-number-input label="Vertical" buttonLayout="vertical" [value]="3" hint="Increment on top, decrement on bottom"></z-number-input>
      <z-number-input label="Blank" buttonLayout="blank" [value]="25" hint="Without stepper buttons"></z-number-input>
    </z-stack>
  `,
})
export class NumberInputLayout {}

```


================================================================================
# COMPONENT: OTP-INPUT
================================================================================

## Documentation

# otp-input — Angular

Processed requirements of [`<z-otp-input>`](../../../../../requirements/04-components/form/otp-input.md) for Angular (`@zelviora/angular`).

## Usage

```ts
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { TextValueAccessor, ZOtpInput } from '@zelviora/angular';

@Component({
  selector: 'app-code',
  imports: [FormsModule, TextValueAccessor, ZOtpInput],
  template: `<z-otp-input label="Verification code" name="code" [(ngModel)]="code"></z-otp-input>`,
})
export class Code { code = ''; }
```

The cells form one Tab stop and are always laid out left to right; paste and SMS autofill
(`autocomplete="one-time-code"` on the first cell) spread over the cells. `type` (`numeric`, `alphanumeric`,
`alphabetic`) or `char-pattern` filter each character; an incomplete code is `tooShort` with a localized message.

## Binding

| Value accessor / prop | Model event |
|---|---|
| `TextValueAccessor`, `[(ngModel)]` / `formControl` (`string`) | `zInput` |

Form reset restores the default value without events; reset your state yourself.

## Events

`zInput` (every change), `zChange` (focus leaves the group after a change), `zComplete` (every cell filled).

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `otp-input-default.ts` | D-1 Default |
| `separator` | `otp-input-separator.ts` | D-22 Separator, D-23 Alphanumeric + uppercase |
| `mask` | `otp-input-mask.ts` | D-21 Mask (PIN), D-5 Sizes, D-3 Variants |
| `error` | `otp-input-error.ts` | D-8 Error (setCustomValidity) |
| `form` | `otp-input-form.ts` | D-10 In form (autoSubmit) |

Not yet covered: D-11 RTL page, D-14 length 12 in a narrow area, D-17 verification dialog.


## Examples & Implementation

### Case: default

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZOtpInput, ZStack } from '@zelviora/angular';

/** Six digit cells, one Tab stop; paste or SMS autofill spreads over the cells. */
@Component({
  selector: 'demo-otp-input-default',
  imports: [ZOtpInput, ZStack],
  template: `
    <z-stack gap="sm">
      <z-otp-input label="Verification code" name="code" hint="Sent to your phone" (zComplete)="code.set($event.detail.value)"></z-otp-input>
      <small>Completed: {{ code() || '—' }}</small>
    </z-stack>
  `,
})
export class OtpInputDefault {
  readonly code = signal('');
}

```

### Case: error

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZOtpInput } from '@zelviora/angular';

type OtpElement = HTMLElement & { setCustomValidity(m: string): Promise<void>; reportValidity(): Promise<boolean> };

/** A wrong code reported by the server through setCustomValidity (the right code here is 123456). */
@Component({
  selector: 'demo-otp-input-error',
  imports: [ZOtpInput],
  template: `
    <z-otp-input label="Verification code" hint="Try 111111, then 123456" (zInput)="reset($event)" (zComplete)="check($event)"></z-otp-input>
  `,
})
export class OtpInputError {
  reset(e: Event) {
    void (e.target as OtpElement).setCustomValidity('');
  }

  async check(e: CustomEvent<{ value: string }>) {
    const el = e.target as OtpElement;
    await el.setCustomValidity(e.detail.value === '123456' ? '' : 'Wrong code, check the latest SMS.');
    await el.reportValidity();
  }
}

```

### Case: form

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZOtpInput, ZStack } from '@zelviora/angular';

/** autoSubmit: the form is submitted as soon as every cell is filled. */
@Component({
  selector: 'demo-otp-input-form',
  imports: [ZOtpInput, ZStack],
  template: `
    <form (submit)="submit($event)">
      <z-stack gap="sm">
        <z-otp-input label="Code" name="code" [length]="4" [autoSubmit]="true" [required]="true"></z-otp-input>
        @if (sent()) {
          <output>{{ sent() }}</output>
        }
      </z-stack>
    </form>
  `,
})
export class OtpInputForm {
  readonly sent = signal('');

  submit(e: Event) {
    e.preventDefault();
    this.sent.set(JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]));
  }
}

```

### Case: mask

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZOtpInput, ZStack } from '@zelviora/angular';

/** Masked PIN of four digits in the three sizes. */
@Component({
  selector: 'demo-otp-input-mask',
  imports: [ZOtpInput, ZStack],
  template: `
    <z-stack>
      <z-otp-input label="PIN (sm)" [length]="4" [mask]="true" size="sm"></z-otp-input>
      <z-otp-input label="PIN (md)" [length]="4" [mask]="true"></z-otp-input>
      <z-otp-input label="PIN (lg)" [length]="4" [mask]="true" size="lg" variant="filled"></z-otp-input>
    </z-stack>
  `,
})
export class OtpInputMask {}

```

### Case: separator

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZOtpInput, ZStack } from '@zelviora/angular';

/** A separator after cell 3; letters and digits in upper case for a licence key. */
@Component({
  selector: 'demo-otp-input-separator',
  imports: [ZOtpInput, ZStack],
  template: `
    <z-stack>
      <z-otp-input label="Code" [separatorAfter]="3"></z-otp-input>
      <z-otp-input label="Licence key" [length]="8" [separatorAfter]="4" type="alphanumeric" [uppercase]="true"></z-otp-input>
    </z-stack>
  `,
})
export class OtpInputSeparator {}

```


================================================================================
# COMPONENT: PAGINATION
================================================================================

## Documentation

# pagination — Angular

Processed requirements of `z-pagination` ([spec](../../../../../requirements/04-components/navigation/pagination.md)) for Angular
(`@zelviora/angular`).

## Binding and events

| Input | Output | Detail |
|---|---|---|
| `[page]` | `(zPageChange)` | `{ page, reason }` |
| `[pageSize]` | `(zPageSizeChange)` | `{ pageSize }` |

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `pagination-default.ts` | D-1 Default, D-6 States, D-15 Keyboard-only |
| `simple` | `pagination-simple.ts` | D-3 Variants (simple), D-20 Empty (total 0) |
| `controlled` | `pagination-controlled.ts` | D-9 Controlled, D-22 Page size, D-23 Quick jumper, D-14 Long content |
| `links` | `pagination-links.ts` | D-21 Links |

## Differences

- Bind booleans with `[prop]="true"`; plain attributes are strings.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZPagination, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-pagination-controlled',
  imports: [ZPagination, ZStack],
  template: `
    <z-stack gap="sm">
      <z-pagination
        [total]="12500"
        [page]="page()"
        [pageSize]="pageSize()"
        [pageSizeOptions]="sizes"
        [showQuickJumper]="true"
        (zPageChange)="page.set($event.detail.page)"
        (zPageSizeChange)="pageSize.set($event.detail.pageSize)"
      ></z-pagination>
      <p>Page {{ page() }}, {{ pageSize() }} per page</p>
    </z-stack>
  `,
})
export class PaginationControlled {
  readonly sizes = [10, 20, 50, 100];
  readonly page = signal(3);
  readonly pageSize = signal(20);
}

```

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZPagination } from '@zelviora/angular';

@Component({
  selector: 'demo-pagination-default',
  imports: [ZPagination],
  template: `<z-pagination [total]="230" [showFirstLast]="true" [showSummary]="true"></z-pagination>`,
})
export class PaginationDefault {}

```

### Case: links

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZPagination } from '@zelviora/angular';

@Component({
  selector: 'demo-pagination-links',
  imports: [ZPagination],
  template: `<z-pagination [total]="95" [getPageHref]="hrefOf"></z-pagination>`,
})
export class PaginationLinks {
  readonly hrefOf = (page: number) => `#pagination-page-${page}`;
}

```

### Case: simple

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZPagination, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-pagination-simple',
  imports: [ZPagination, ZStack],
  template: `
    <z-stack gap="sm">
      <z-pagination [total]="230" [simple]="true"></z-pagination>
      <z-pagination [total]="0" [simple]="true"></z-pagination>
    </z-stack>
  `,
})
export class PaginationSimple {}

```


================================================================================
# COMPONENT: PARALLEL-CHART
================================================================================

## Documentation

# Parallel chart (`<z-parallel-chart>`)

Multi-dimensional parallel coordinate axes for comparing high-dimensional configurations.

## Installation & Import

```tsx
// React (@zelviora/react-chart)
import { ZParallelChart } from '@zelviora/react-chart';

// Vue 3 (@zelviora/vue-chart)
import { ZParallelChart } from '@zelviora/vue-chart';

// Angular (@zelviora/angular-chart)
import { ZParallelChart } from '@zelviora/angular-chart';

// Web Components (@zelviora/chart)
import '@zelviora/chart';
```

## Key Features

- **Tree-shaken ECharts 6 Core**: Automatically registers only the required ECharts chart module and components.
- **Design System Token Synchronization**: Reads `--z-chart-series-1..8`, `--z-chart-grid-color`, and `--z-chart-axis-color`, reacting automatically to Light/Dark mode and theme preset changes.
- **Built-in Accessibility (WCAG AAA)**: Renders a semantic `<figure>` with `<figcaption>`, interactive `aria-pressed` legend toggles, and a synchronized `<table>` for screen readers.
- **Escape Hatch (`option`)**: Deep-merges any raw ECharts `option` object on top of the declarative props.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZParallelChart } from '@zelviora/angular-chart';
import { parallelAxes, parallelData, parallelSeries } from '../data';

@Component({
  selector: 'demo-parallel-chart-basic',
  imports: [ZParallelChart],
  template: `
    <z-parallel-chart
      heading="AI Model Benchmark Trade-offs"
      description="Comparing accuracy, latency, memory footprint, and throughput across four model checkpoints."
      xKey="model" [axes]="axes" [data]="data" [series]="series"
    ></z-parallel-chart>
  `,
})
export class ParallelChartBasic {
  readonly axes = parallelAxes;
  readonly data = parallelData;
  readonly series = parallelSeries;
}

```

### Case: controlled

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/angular';
import { ZParallelChart, type ChartPointSelectDetail, type ChartSeriesToggleDetail } from '@zelviora/angular-chart';
import { parallelAxes, parallelData, parallelSeries } from '../data';

@Component({
  selector: 'demo-parallel-chart-controlled',
  imports: [ZStack, ZButton, ZBadge, ZText, ZParallelChart],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <z-button size="sm" variant="outline" (click)="hidden = []">
          Show All Series
        </z-button>
        <z-badge tone="primary" variant="soft">{{ selected }}</z-badge>
        <z-text variant="muted" size="sm">
          Hidden: {{ hidden.length ? hidden.join(', ') : 'none' }}
        </z-text>
      </z-stack>
      <z-parallel-chart
        heading="AI Model Benchmark Trade-offs (Interactive)"
        description="Comparing accuracy, latency, memory footprint, and throughput across four model checkpoints."
        xKey="model" [axes]="axes" [data]="data" [series]="series"
        [selectable]="true"
        [hiddenSeries]="hidden"
        (zSeriesToggle)="onToggle($event)"
        (zPointSelect)="onSelect($event)"
      ></z-parallel-chart>
    </z-stack>
  `,
})
export class ParallelChartControlled {
  readonly axes = parallelAxes;
  readonly data = parallelData;
  readonly series = parallelSeries;
  hidden: string[] = [];
  selected = 'Click any chart element to inspect';

  onToggle(e: CustomEvent<ChartSeriesToggleDetail>) {
    this.hidden = e.detail.hiddenSeries;
  }

  onSelect(e: CustomEvent<ChartPointSelectDetail>) {
    this.selected = `Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`;
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZParallelChart } from '@zelviora/angular-chart';
import { parallelAxes, parallelData, parallelSeries } from '../data';

@Component({
  selector: 'demo-parallel-chart-customization',
  imports: [ZParallelChart],
  template: `
    <z-parallel-chart
      class="demo-chart-brand"
      description="Comparing accuracy, latency, memory footprint, and throughput across four model checkpoints."
      [valueFormat]="{ maximumFractionDigits: 1 }"
      xKey="model" [axes]="axes" [data]="data" [series]="series" [smooth]="true" [lineOpacity]="0.85" renderer="canvas"
    >
      <span slot="heading">AI Model Benchmark Trade-offs — Custom Theme Tokens &amp; Canvas</span>
    </z-parallel-chart>
  `,
})
export class ParallelChartCustomization {
  readonly axes = parallelAxes;
  readonly data = parallelData;
  readonly series = parallelSeries;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZParallelChart } from '@zelviora/angular-chart';
import { parallelAxes, parallelData, parallelSeries } from '../data';

@Component({
  selector: 'demo-parallel-chart-states',
  imports: [ZStack, ZParallelChart],
  template: `
    <z-stack gap="lg">
      <z-parallel-chart
        heading="Loading State (aria-busy)"
        [loading]="true"
        xKey="model" [axes]="axes" [data]="data" [series]="series"
      ></z-parallel-chart>
      <z-parallel-chart
        heading="Empty State"
        [data]="[]"
        [series]="series"
      ></z-parallel-chart>
      <z-parallel-chart
        heading="Expanded Accessible Data Table"
        description="Comparing accuracy, latency, memory footprint, and throughput across four model checkpoints."
        [showDataTable]="true"
        xKey="model" [axes]="axes" [data]="data" [series]="series"
      ></z-parallel-chart>
    </z-stack>
  `,
})
export class ParallelChartStates {
  readonly axes = parallelAxes;
  readonly data = parallelData;
  readonly series = parallelSeries;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZParallelChart } from '@zelviora/angular-chart';
import { parallelAxes, parallelData, parallelSeries } from '../data';

@Component({
  selector: 'demo-parallel-chart-variants',
  imports: [ZStack, ZParallelChart],
  template: `
    <z-stack gap="lg">
      <z-parallel-chart
        heading="Smooth Coordinate Splines"
        description="Smooth parallel coordinate splines vs crisp polylines with subtle opacity."
        xKey="model" [axes]="axes" [data]="data" [series]="series" [smooth]="true" [lineOpacity]="0.75"
      ></z-parallel-chart>
      <z-parallel-chart
        heading="Crisp Polylines"
        description="Smooth parallel coordinate splines vs crisp polylines with subtle opacity."
        xKey="model" [axes]="axes" [data]="data" [series]="series" [smooth]="false" [lineOpacity]="0.4"
      ></z-parallel-chart>
    </z-stack>
  `,
})
export class ParallelChartVariants {
  readonly axes = parallelAxes;
  readonly data = parallelData;
  readonly series = parallelSeries;
}

```


================================================================================
# COMPONENT: PASSWORD-INPUT
================================================================================

## Documentation

# password-input — Angular

Processed requirements of [`<z-password-input>`](../../../../../requirements/04-components/form/password-input.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-password-input label="Password" name="password" [(ngModel)]="password"></z-password-input>
```

## Binding

`[(ngModel)]` / `formControl` through the text value accessor (and the validity validator); `[visible]` with `(zVisibleChange)`.

## Events

`zInput`, `zChange` like the input; `zVisibleChange` `{ visible }` when the user shows or hides the password.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `password-input-basic.ts` | D-1 Default, D-22 Caps Lock |
| `strength` | `password-input-strength.ts` | D-21 Strength, D-9 Controlled |
| `form` | `password-input-form.ts` | D-10 In form, D-17 Composition |
| `states` | `password-input-states.ts` | D-3 Variants, D-5 Sizes, D-6 States, D-7 Disabled, D-8 Error |


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZPasswordInput } from '@zelviora/angular';

@Component({
  selector: 'demo-password-input-basic',
  imports: [ZPasswordInput],
  template: `
    <div class="demo-narrow">
      <z-password-input label="Password" name="password" hint="Caps Lock is detected while you type"></z-password-input>
    </div>
  `,
})
export class PasswordInputBasic {}

```

### Case: form

#### Angular
```typescript
import { Component, computed, signal } from '@angular/core';
import { ZButton, ZField, ZInput, ZPasswordInput, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-password-input-form',
  imports: [ZButton, ZField, ZInput, ZPasswordInput, ZStack],
  template: `
    <form class="demo-narrow" (submit)="onSubmit($event)">
      <z-stack gap="md">
        <z-input label="Email" name="email" type="email" autocomplete="username" [required]="true"></z-input>
        <z-password-input label="Password" name="password" autocomplete="new-password" [minLength]="8" [required]="true" [value]="password()" (zInput)="password.set($event.detail.value)"></z-password-input>
        <z-field label="Confirm password" [error]="mismatch()">
          <z-password-input name="confirm" autocomplete="new-password" [required]="true" [value]="confirm()" (zInput)="confirm.set($event.detail.value)"></z-password-input>
        </z-field>
        <z-stack orientation="horizontal" gap="sm">
          <z-button type="submit">Create account</z-button>
          <z-button type="reset" variant="ghost" tone="neutral" (click)="reset()">Reset</z-button>
        </z-stack>
        @if (result()) {
          <small>{{ result() }}</small>
        }
      </z-stack>
    </form>
  `,
})
export class PasswordInputForm {
  readonly password = signal('');
  readonly confirm = signal('');
  readonly result = signal('');
  readonly mismatch = computed(() => (this.confirm() !== '' && this.confirm() !== this.password() ? 'The passwords do not match.' : null));

  onSubmit(event: Event) {
    event.preventDefault();
    const data = new FormData(event.target as HTMLFormElement);
    this.result.set(this.mismatch() ? '' : `Submitted for ${data.get('email')} (${String(data.get('password')).length} characters)`);
  }

  reset() {
    this.password.set('');
    this.confirm.set('');
    this.result.set('');
  }
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGrid, ZPasswordInput } from '@zelviora/angular';

@Component({
  selector: 'demo-password-input-states',
  imports: [ZGrid, ZPasswordInput],
  template: `
    <z-grid columns="1 md:2" gap="md">
      <z-password-input label="Visible" value="correct horse" [visible]="true"></z-password-input>
      <z-password-input label="Filled, small" variant="filled" size="sm" value="secret"></z-password-input>
      <z-password-input label="Disabled" value="secret" [disabled]="true"></z-password-input>
      <z-password-input label="Too short" value="abc" [minLength]="8" [invalid]="true" hint="At least 8 characters"></z-password-input>
      <z-password-input label="Without toggle" value="secret" [hideToggle]="true"></z-password-input>
      <z-password-input label="Large" size="lg" placeholder="Enter your password"></z-password-input>
    </z-grid>
  `,
})
export class PasswordInputStates {}

```

### Case: strength

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZPasswordInput } from '@zelviora/angular';

@Component({
  selector: 'demo-password-input-strength',
  imports: [ZPasswordInput],
  template: `
    <div class="demo-narrow">
      <z-password-input
        label="New password"
        autocomplete="new-password"
        [value]="value()"
        [strength]="value() ? score(value()) : undefined"
        (zInput)="value.set($event.detail.value)"
      ></z-password-input>
    </div>
  `,
})
export class PasswordInputStrength {
  readonly value = signal('');

  /** App-side strength (the library never computes it): a simple length and variety score from 0 to 4. */
  score(value: string): number {
    if (!value) return 0;
    let s = value.length >= 8 ? 1 : 0;
    if (value.length >= 12) s++;
    if (/[A-Z]/.test(value) && /[a-z]/.test(value)) s++;
    if (/\d/.test(value) && /[^\w\s]/.test(value)) s++;
    return Math.min(4, s);
  }
}

```


================================================================================
# COMPONENT: PICTORIAL-BAR-CHART
================================================================================

## Documentation

# Pictorial bar chart (`<z-pictorial-bar-chart>`)

Symbolic and isotopic bar chart using repeated or stretched geometric glyphs.

## Installation & Import

```tsx
// React (@zelviora/react-chart)
import { ZPictorialBarChart } from '@zelviora/react-chart';

// Vue 3 (@zelviora/vue-chart)
import { ZPictorialBarChart } from '@zelviora/vue-chart';

// Angular (@zelviora/angular-chart)
import { ZPictorialBarChart } from '@zelviora/angular-chart';

// Web Components (@zelviora/chart)
import '@zelviora/chart';
```

## Key Features

- **Tree-shaken ECharts 6 Core**: Automatically registers only the required ECharts chart module and components.
- **Design System Token Synchronization**: Reads `--z-chart-series-1..8`, `--z-chart-grid-color`, and `--z-chart-axis-color`, reacting automatically to Light/Dark mode and theme preset changes.
- **Built-in Accessibility (WCAG AAA)**: Renders a semantic `<figure>` with `<figcaption>`, interactive `aria-pressed` legend toggles, and a synchronized `<table>` for screen readers.
- **Escape Hatch (`option`)**: Deep-merges any raw ECharts `option` object on top of the declarative props.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZPictorialBarChart } from '@zelviora/angular-chart';
import { rackData, rackSeries } from '../data';

@Component({
  selector: 'demo-pictorial-bar-chart-basic',
  imports: [ZPictorialBarChart],
  template: `
    <z-pictorial-bar-chart
      heading="Data Center Rack Capacity by Zone"
      description="Provisioned vs active server racks visualized with symbolic pictorial bars."
      xKey="zone" [data]="data" [series]="series"
    ></z-pictorial-bar-chart>
  `,
})
export class PictorialBarChartBasic {
  readonly data = rackData;
  readonly series = rackSeries;
}

```

### Case: controlled

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/angular';
import { ZPictorialBarChart, type ChartPointSelectDetail, type ChartSeriesToggleDetail } from '@zelviora/angular-chart';
import { rackData, rackSeries } from '../data';

@Component({
  selector: 'demo-pictorial-bar-chart-controlled',
  imports: [ZStack, ZButton, ZBadge, ZText, ZPictorialBarChart],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <z-button size="sm" variant="outline" (click)="hidden = []">
          Show All Series
        </z-button>
        <z-badge tone="primary" variant="soft">{{ selected }}</z-badge>
        <z-text variant="muted" size="sm">
          Hidden: {{ hidden.length ? hidden.join(', ') : 'none' }}
        </z-text>
      </z-stack>
      <z-pictorial-bar-chart
        heading="Data Center Rack Capacity by Zone (Interactive)"
        description="Provisioned vs active server racks visualized with symbolic pictorial bars."
        xKey="zone" [data]="data" [series]="series"
        [selectable]="true"
        [hiddenSeries]="hidden"
        (zSeriesToggle)="onToggle($event)"
        (zPointSelect)="onSelect($event)"
      ></z-pictorial-bar-chart>
    </z-stack>
  `,
})
export class PictorialBarChartControlled {
  readonly data = rackData;
  readonly series = rackSeries;
  hidden: string[] = [];
  selected = 'Click any chart element to inspect';

  onToggle(e: CustomEvent<ChartSeriesToggleDetail>) {
    this.hidden = e.detail.hiddenSeries;
  }

  onSelect(e: CustomEvent<ChartPointSelectDetail>) {
    this.selected = `Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`;
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZPictorialBarChart } from '@zelviora/angular-chart';
import { rackData, rackSeries } from '../data';

@Component({
  selector: 'demo-pictorial-bar-chart-customization',
  imports: [ZPictorialBarChart],
  template: `
    <z-pictorial-bar-chart
      class="demo-chart-brand"
      description="Provisioned vs active server racks visualized with symbolic pictorial bars."
      [valueFormat]="{ maximumFractionDigits: 1 }"
      xKey="zone" [data]="data" [series]="series" symbol="triangle" renderer="canvas"
    >
      <span slot="heading">Data Center Rack Capacity by Zone — Custom Theme Tokens &amp; Canvas</span>
    </z-pictorial-bar-chart>
  `,
})
export class PictorialBarChartCustomization {
  readonly data = rackData;
  readonly series = rackSeries;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZPictorialBarChart } from '@zelviora/angular-chart';
import { rackData, rackSeries } from '../data';

@Component({
  selector: 'demo-pictorial-bar-chart-states',
  imports: [ZStack, ZPictorialBarChart],
  template: `
    <z-stack gap="lg">
      <z-pictorial-bar-chart
        heading="Loading State (aria-busy)"
        [loading]="true"
        xKey="zone" [data]="data" [series]="series"
      ></z-pictorial-bar-chart>
      <z-pictorial-bar-chart
        heading="Empty State"
        [data]="[]"
        [series]="series"
      ></z-pictorial-bar-chart>
      <z-pictorial-bar-chart
        heading="Expanded Accessible Data Table"
        description="Provisioned vs active server racks visualized with symbolic pictorial bars."
        [showDataTable]="true"
        xKey="zone" [data]="data" [series]="series"
      ></z-pictorial-bar-chart>
    </z-stack>
  `,
})
export class PictorialBarChartStates {
  readonly data = rackData;
  readonly series = rackSeries;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZPictorialBarChart } from '@zelviora/angular-chart';
import { rackData, rackSeries } from '../data';

@Component({
  selector: 'demo-pictorial-bar-chart-variants',
  imports: [ZStack, ZPictorialBarChart],
  template: `
    <z-stack gap="lg">
      <z-pictorial-bar-chart
        heading="Repeated Diamond Glyphs"
        description="Repeated clipped diamond glyphs vs horizontal rounded pictorial bars."
        xKey="zone" [data]="data" [series]="series" symbol="diamond" [symbolRepeat]="true" [symbolClip]="true" [symbolSize]="18"
      ></z-pictorial-bar-chart>
      <z-pictorial-bar-chart
        heading="Horizontal Pictorial Bars"
        description="Repeated clipped diamond glyphs vs horizontal rounded pictorial bars."
        xKey="zone" [data]="data" [series]="series" orientation="horizontal" symbol="roundRect"
      ></z-pictorial-bar-chart>
    </z-stack>
  `,
})
export class PictorialBarChartVariants {
  readonly data = rackData;
  readonly series = rackSeries;
}

```


================================================================================
# COMPONENT: PIE-CHART
================================================================================

## Documentation

# Pie chart (`<z-pie-chart>`)

Proportional slice and Nightingale rose charts powered by ECharts PieChart.

## Installation & Import

```tsx
// React (@zelviora/react-chart)
import { ZPieChart } from '@zelviora/react-chart';

// Vue 3 (@zelviora/vue-chart)
import { ZPieChart } from '@zelviora/vue-chart';

// Angular (@zelviora/angular-chart)
import { ZPieChart } from '@zelviora/angular-chart';

// Web Components (@zelviora/chart)
import '@zelviora/chart';
```

## Key Features

- **Tree-shaken ECharts 6 Core**: Automatically registers only the required ECharts chart module and components.
- **Design System Token Synchronization**: Reads `--z-chart-series-1..8`, `--z-chart-grid-color`, and `--z-chart-axis-color`, reacting automatically to Light/Dark mode and theme preset changes.
- **Built-in Accessibility (WCAG AAA)**: Renders a semantic `<figure>` with `<figcaption>`, interactive `aria-pressed` legend toggles, and a synchronized `<table>` for screen readers.
- **Escape Hatch (`option`)**: Deep-merges any raw ECharts `option` object on top of the declarative props.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZPieChart } from '@zelviora/angular-chart';
import { channelData, channelSeries } from '../data';

@Component({
  selector: 'demo-pie-chart-basic',
  imports: [ZPieChart],
  template: `
    <z-pie-chart
      heading="Traffic Acquisition Share by Channel"
      description="Organic search leads acquisition followed by Direct, Referral, and Social channels."
      xKey="channel" [data]="data" [series]="series"
    ></z-pie-chart>
  `,
})
export class PieChartBasic {
  readonly data = channelData;
  readonly series = channelSeries;
}

```

### Case: controlled

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/angular';
import { ZPieChart, type ChartPointSelectDetail, type ChartSeriesToggleDetail } from '@zelviora/angular-chart';
import { channelData, channelSeries } from '../data';

@Component({
  selector: 'demo-pie-chart-controlled',
  imports: [ZStack, ZButton, ZBadge, ZText, ZPieChart],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <z-button size="sm" variant="outline" (click)="hidden = []">
          Show All Series
        </z-button>
        <z-badge tone="primary" variant="soft">{{ selected }}</z-badge>
        <z-text variant="muted" size="sm">
          Hidden: {{ hidden.length ? hidden.join(', ') : 'none' }}
        </z-text>
      </z-stack>
      <z-pie-chart
        heading="Traffic Acquisition Share by Channel (Interactive)"
        description="Organic search leads acquisition followed by Direct, Referral, and Social channels."
        xKey="channel" [data]="data" [series]="series"
        [selectable]="true"
        [hiddenSeries]="hidden"
        (zSeriesToggle)="onToggle($event)"
        (zPointSelect)="onSelect($event)"
      ></z-pie-chart>
    </z-stack>
  `,
})
export class PieChartControlled {
  readonly data = channelData;
  readonly series = channelSeries;
  hidden: string[] = [];
  selected = 'Click any chart element to inspect';

  onToggle(e: CustomEvent<ChartSeriesToggleDetail>) {
    this.hidden = e.detail.hiddenSeries;
  }

  onSelect(e: CustomEvent<ChartPointSelectDetail>) {
    this.selected = `Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`;
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZPieChart } from '@zelviora/angular-chart';
import { channelData, channelSeries } from '../data';

@Component({
  selector: 'demo-pie-chart-customization',
  imports: [ZPieChart],
  template: `
    <z-pie-chart
      class="demo-chart-brand"
      description="Organic search leads acquisition followed by Direct, Referral, and Social channels."
      [valueFormat]="{ maximumFractionDigits: 1 }"
      xKey="channel" [data]="data" [series]="series" outerRadius="68%" [padAngle]="4" renderer="canvas"
    >
      <span slot="heading">Traffic Acquisition Share by Channel — Custom Theme Tokens &amp; Canvas</span>
    </z-pie-chart>
  `,
})
export class PieChartCustomization {
  readonly data = channelData;
  readonly series = channelSeries;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZPieChart } from '@zelviora/angular-chart';
import { channelData, channelSeries } from '../data';

@Component({
  selector: 'demo-pie-chart-states',
  imports: [ZStack, ZPieChart],
  template: `
    <z-stack gap="lg">
      <z-pie-chart
        heading="Loading State (aria-busy)"
        [loading]="true"
        xKey="channel" [data]="data" [series]="series"
      ></z-pie-chart>
      <z-pie-chart
        heading="Empty State"
        [data]="[]"
        [series]="series"
      ></z-pie-chart>
      <z-pie-chart
        heading="Expanded Accessible Data Table"
        description="Organic search leads acquisition followed by Direct, Referral, and Social channels."
        [showDataTable]="true"
        xKey="channel" [data]="data" [series]="series"
      ></z-pie-chart>
    </z-stack>
  `,
})
export class PieChartStates {
  readonly data = channelData;
  readonly series = channelSeries;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZPieChart } from '@zelviora/angular-chart';
import { channelData, channelSeries } from '../data';

@Component({
  selector: 'demo-pie-chart-variants',
  imports: [ZStack, ZPieChart],
  template: `
    <z-stack gap="lg">
      <z-pie-chart
        heading="Nightingale Radius Rose"
        description="Nightingale radius rose chart with slice padding vs equal-angle area rose chart."
        xKey="channel" [data]="data" [series]="series" roseType="radius" [padAngle]="2"
      ></z-pie-chart>
      <z-pie-chart
        heading="Equal-Angle Area Rose"
        description="Nightingale radius rose chart with slice padding vs equal-angle area rose chart."
        xKey="channel" [data]="data" [series]="series" roseType="area" [startAngle]="180"
      ></z-pie-chart>
    </z-stack>
  `,
})
export class PieChartVariants {
  readonly data = channelData;
  readonly series = channelSeries;
}

```


================================================================================
# COMPONENT: POPCONFIRM
================================================================================

## Documentation

# popconfirm — Angular

Processed requirements of [`<z-popconfirm>`](../../../../../requirements/04-components/overlay-feedback/popconfirm.md) for Angular (`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```html
<z-popconfirm heading="Delete this row?" tone="destructive" (zConfirm)="remove()">
  <z-button slot="trigger">Delete</z-button>
</z-popconfirm>
```

## Binding

`[open]` + `(zOpenChange)`.

## Events

`(zConfirm)` (cancelable: `preventDefault()` keeps it open), `(zCancel)` (`{ reason }`), `(zBeforeOpen)`, `(zBeforeClose)` (cancelable), `(zOpenChange)`, `(zAfterOpen)`, `(zAfterClose)`.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `popconfirm-default.ts` | D-1 Default, D-4 Tones (destructive) |
| `async` | `popconfirm-async.ts` | D-4 Tones, D-6 States / D-20 actionLoading, D-7 Disabled, D-8 Error (kept open), D-9 Controlled |

## Differences

- Non-modal (`role="dialog"`); for serious actions use the alert dialog.
- The content stays at its DOM position (top layer, no portal), so it inherits theme and direction from where it is placed.


## Examples & Implementation

### Case: async

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZPopconfirm, ZStack } from '@zelviora/angular';

/** Keeps the confirmation open while a (fake) request runs: preventDefault() on confirm, then close from state. */
@Component({
  selector: 'demo-popconfirm-async',
  imports: [ZButton, ZPopconfirm, ZStack],
  template: `
    <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
      <z-popconfirm
        heading="Archive this project?"
        tone="warning"
        actionLabel="Archive"
        [open]="open()"
        [actionLoading]="loading()"
        (zOpenChange)="open.set($event.detail.open)"
        (zConfirm)="confirm($event)"
        (zCancel)="loading.set(false)"
      >
        <z-button slot="trigger" variant="outline" tone="warning">Archive</z-button>
      </z-popconfirm>
      <z-popconfirm heading="Send the invitation again?" tone="info" placement="bottom" actionLabel="Send">
        <z-button slot="trigger" variant="outline" tone="info">Resend</z-button>
      </z-popconfirm>
      <z-popconfirm heading="Disabled trigger never opens">
        <z-button slot="trigger" variant="outline" tone="neutral" [disabled]="true">Disabled</z-button>
      </z-popconfirm>
    </z-stack>
  `,
})
export class PopconfirmAsync {
  readonly open = signal(false);
  readonly loading = signal(false);

  confirm(e: Event) {
    e.preventDefault();
    this.loading.set(true);
    setTimeout(() => {
      this.loading.set(false);
      this.open.set(false);
    }, 1000);
  }
}

```

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZPopconfirm } from '@zelviora/angular';

@Component({
  selector: 'demo-popconfirm-default',
  imports: [ZButton, ZPopconfirm],
  template: `
    <z-popconfirm heading="Delete this row?" description="You can restore it from the trash for 30 days." tone="destructive" actionLabel="Delete">
      <z-button slot="trigger" variant="outline" tone="destructive">Delete</z-button>
    </z-popconfirm>
  `,
})
export class PopconfirmDefault {}

```


================================================================================
# COMPONENT: POPOVER
================================================================================

## Documentation

# popover — Angular

Processed requirements of [`<z-popover>`](../../../../../requirements/04-components/overlay-feedback/popover.md) for Angular
(`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component } from '@angular/core';
import { ZButton, ZPopover } from '@zelviora/angular';

@Component({
  selector: 'app-filters',
  imports: [ZButton, ZPopover],
  template: `
    <z-popover heading="Filters">
      <z-button slot="trigger">Filter</z-button>
      …
    </z-popover>
  `,
})
export class Filters {}
```

## Binding

`[open]` + `(zOpenChange)` (no `[(open)]`: the output is `zOpenChange`, not `openChange`).

## Events

`(zBeforeOpen)`, `(zBeforeClose)` (cancelable), `(zOpenChange)` (`{ open, reason }`), `(zAfterOpen)`, `(zAfterClose)`.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `popover-default.ts` | D-1 Default |
| `placement` | `popover-placement.ts` | D-3 Variants (arrow), D-6 placements |

## Differences

- The content stays at its DOM position (top layer, no portal), so it inherits theme and direction from where it is placed.
- Boolean props are bound with `[prop]="true"` (`[arrow]="true"`, `[dismissible]="true"`).
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZPopover, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-popover-default',
  imports: [ZButton, ZPopover, ZStack],
  template: `
    <z-popover heading="Filters">
      <z-button slot="trigger" variant="outline" tone="neutral">Filter</z-button>
      <z-stack gap="sm">
        <label><input type="checkbox" name="active" /> Only active projects</label>
        <label><input type="checkbox" name="mine" /> Only my projects</label>
      </z-stack>
    </z-popover>
  `,
})
export class PopoverDefault {}

```

### Case: placement

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZPopover, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-popover-placement',
  imports: [ZButton, ZPopover, ZStack],
  template: `
    <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
      @for (placement of placements; track placement) {
        <z-popover [label]="'Placed ' + placement" [placement]="placement" [arrow]="true" [dismissible]="true">
          <z-button slot="trigger" variant="outline" tone="neutral">{{ placement }}</z-button>
          <p>Flips and shifts to stay in the viewport.</p>
        </z-popover>
      }
    </z-stack>
  `,
})
export class PopoverPlacement {
  readonly placements = ['top', 'right', 'bottom', 'left'] as const;
}

```


================================================================================
# COMPONENT: PROGRESS
================================================================================

## Documentation

# progress — Angular

Processed requirements of [`<z-progress>`](../../../../../requirements/04-components/overlay-feedback/progress.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-progress label="Upload" [value]="40" [showValue]="true"></z-progress>
```

## Binding

No model event: the app sets `value` (`null` = indeterminate).

## Events

`zComplete` `{ value }` when a progressbar reaches `max` (not on first render).

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `progress-basic.ts` | D-1 Default |
| `variants` | `progress-variants.ts` | D-3 Variants, D-5 Sizes |
| `states` | `progress-states.ts` | D-4 Tones, D-6 States, D-8 Error, D-20 Loading |
| `controlled` | `progress-controlled.ts` | D-9 Controlled |


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZProgress } from '@zelviora/angular';

@Component({
  selector: 'demo-progress-basic',
  imports: [ZProgress],
  template: `
    <div class="demo-narrow">
      <z-progress label="Uploading report.pdf" [value]="40" [showValue]="true"></z-progress>
    </div>
  `,
})
export class ProgressBasic {}

```

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZProgress, ZStack, ZText } from '@zelviora/angular';

@Component({
  selector: 'demo-progress-controlled',
  imports: [ZButton, ZProgress, ZStack, ZText],
  template: `
    <z-stack gap="md" class="demo-narrow">
      <z-progress
        label="Importing files"
        [value]="files()"
        [max]="10"
        [valueText]="files() + ' of 10 files'"
        [showValue]="true"
        [announce]="true"
        (zComplete)="done.set(true)"
      ></z-progress>
      <z-stack orientation="horizontal" align-items="center" gap="sm">
        <z-button size="sm" [disabled]="files() >= 10" (click)="files.set(min(10, files() + 1))">Import one</z-button>
        <z-button size="sm" variant="ghost" tone="neutral" (click)="restart()">Restart</z-button>
        <z-text variant="muted" size="sm">{{ done() ? 'zComplete received' : 'Running' }}</z-text>
      </z-stack>
    </z-stack>
  `,
})
export class ProgressControlled {
  readonly files = signal(0);
  readonly done = signal(false);
  readonly min = Math.min;

  restart() {
    this.files.set(0);
    this.done.set(false);
  }
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZProgress, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-progress-states',
  imports: [ZProgress, ZStack],
  template: `
    <z-stack gap="md" class="demo-narrow">
      <z-progress label="Not started" [value]="0" [showValue]="true"></z-progress>
      <z-progress label="Half way" [value]="50" [showValue]="true"></z-progress>
      <z-progress label="Done" [value]="100" [showValue]="true"></z-progress>
      <z-progress label="Preparing the export (indeterminate)"></z-progress>
      <z-progress label="Upload failed" [value]="64" tone="destructive" valueText="Failed at 64%" [showValue]="true"></z-progress>
      @for (tone of tones; track tone) {
        <z-progress [label]="'Tone ' + tone" [tone]="tone" [value]="30"></z-progress>
      }
    </z-stack>
  `,
})
export class ProgressStates {
  readonly tones = ['primary', 'success', 'warning', 'info', 'neutral'] as const;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGrid, ZProgress, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-progress-variants',
  imports: [ZGrid, ZProgress, ZStack],
  template: `
    <z-grid columns="1 md:2" gap="lg">
      <z-stack gap="md">
        @for (size of sizes; track size) {
          <z-progress [label]="'Linear ' + size" [size]="size" [value]="60" [showValue]="true"></z-progress>
        }
        <z-progress kind="meter" label="Disk usage" [value]="82" [low]="60" [high]="80" [optimum]="20" valueText="82 GB of 100 GB" [showValue]="true"></z-progress>
      </z-stack>
      <z-stack orientation="horizontal" align-items="center" gap="lg" [wrap]="true">
        @for (size of sizes; track size) {
          <z-progress shape="circle" [label]="'Circle ' + size" [size]="size" [value]="75" [showValue]="true"></z-progress>
        }
        <z-progress shape="circle" kind="meter" label="Battery" [value]="15" [low]="20" [high]="80" [optimum]="90" [showValue]="true"></z-progress>
      </z-stack>
    </z-grid>
  `,
})
export class ProgressVariants {
  readonly sizes = ['sm', 'md', 'lg'] as const;
}

```


================================================================================
# COMPONENT: QR-CODE
================================================================================

## Documentation

# qr-code — Angular

Processed requirements of [`<z-qr-code>`](../../../../../requirements/04-components/data-display/qr-code.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-qr-code value="https://example.com/o/123" label="QR code to open order 123"></z-qr-code>
```

## Binding

No model event. Always show the URL or text next to the code for people who cannot scan it. Colors stay dark on light in every theme (`--z-qr-code-fg` / `--z-qr-code-bg`). Search keyword: "QR", "QRCode" (antd `QRCode`).

## Events

| Output | Detail | Notes |
|---|---|---|
| `(zRefresh)` | `{}` | "Refresh" pressed on the expired overlay; not cancelable |
| `(zError)` | `{ error }` | `value` does not fit at the error correction level; not cancelable |

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `qr-code-basic.ts` | D-1 Default |
| `levels` | `qr-code-levels.ts` | D-3 Variants |
| `sizes` | `qr-code-sizes.ts` | D-5 Sizes |
| `states` | `qr-code-states.ts` | D-6 States, D-15 Keyboard-only, D-19 i18n, D-20 Empty / loading |
| `controlled` | `qr-code-controlled.ts` | D-9 Controlled, D-8 Error, D-14 Long content |
| `custom` | `qr-code-custom.ts` | D-17 Composition, D-18 Customization |


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZQrCode } from '@zelviora/angular';

@Component({
  selector: 'demo-qr-code-basic',
  imports: [ZQrCode],
  template: `
    <z-qr-code value="https://example.com/o/123" label="QR code to open order 123"></z-qr-code>
  `,
})
export class QrCodeBasic {}

```

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { TextValueAccessor, ZInput, ZQrCode, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-qr-code-controlled',
  imports: [FormsModule, TextValueAccessor, ZInput, ZQrCode, ZStack],
  template: `
    <z-stack gap="sm" class="demo-narrow">
      <z-input label="Text to encode" [ngModel]="value()" (ngModelChange)="value.set($event); error.set('')"></z-input>
      <z-qr-code [value]="value()" [label]="'QR code for ' + value()" errorCorrection="H" (zError)="error.set($event.detail.error.message)"></z-qr-code>
      <small>{{ error() || value().length + ' characters' }}</small>
    </z-stack>
  `,
})
export class QrCodeControlled {
  readonly value = signal('https://example.com');
  readonly error = signal('');
}

```

### Case: custom

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCard, ZQrCode, ZStack, ZText } from '@zelviora/angular';

@Component({
  selector: 'demo-qr-code-custom',
  imports: [ZCard, ZQrCode, ZStack, ZText],
  template: `
    <z-card heading="Pay 250 000 ₫" description="Scan with your banking app" class="demo-narrow">
      <z-stack align-items="center" gap="sm">
        <z-qr-code size="lg" value="https://pay.example.com/i/INV-0042?amount=250000" label="Payment QR code for invoice INV-0042">
          <svg slot="icon" viewBox="0 0 24 24" width="40" height="40" aria-hidden="true">
            <rect width="24" height="24" rx="6" fill="currentColor" />
            <path d="M7 12h10M12 7v10" stroke="white" stroke-width="2.5" stroke-linecap="round" />
          </svg>
        </z-qr-code>
        <z-text size="sm">pay.example.com/i/INV-0042</z-text>
      </z-stack>
    </z-card>
  `,
})
export class QrCodeCustom {}

```

### Case: levels

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZQrCode, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-qr-code-levels',
  imports: [ZQrCode, ZStack],
  template: `
    <z-stack orientation="horizontal" [wrap]="true" gap="lg">
      @for (level of levels; track level) {
        <z-stack gap="xs" align-items="center">
          <z-qr-code value="https://example.com/o/123" [errorCorrection]="level" [label]="'QR code, error correction ' + level"></z-qr-code>
          <span>{{ level }}</span>
        </z-stack>
      }
    </z-stack>
  `,
})
export class QrCodeLevels {
  readonly levels = ['L', 'M', 'Q', 'H'] as const;
}

```

### Case: sizes

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZQrCode, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-qr-code-sizes',
  imports: [ZQrCode, ZStack],
  template: `
    <z-stack orientation="horizontal" [wrap]="true" align-items="end" gap="lg">
      @for (size of sizes; track size) {
        <z-qr-code [size]="size" value="https://example.com" [label]="'QR code, size ' + size"></z-qr-code>
      }
    </z-stack>
  `,
})
export class QrCodeSizes {
  readonly sizes = ['sm', 'md', 'lg'] as const;
}

```

### Case: states

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZQrCode, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-qr-code-states',
  imports: [ZQrCode, ZStack],
  template: `
    <z-stack orientation="horizontal" [wrap]="true" gap="lg">
      <z-qr-code [value]="'login-token-' + token()" label="Login QR code" [status]="status()" (zRefresh)="refresh()"></z-qr-code>
      <z-qr-code value="login-token" label="Login QR code (loading)" status="loading"></z-qr-code>
      <z-qr-code value="login-token" label="Login QR code (scanned)" status="scanned"></z-qr-code>
    </z-stack>
  `,
})
export class QrCodeStates {
  readonly token = signal(1);
  readonly status = signal<'expired' | 'loading' | 'active'>('expired');

  refresh() {
    this.status.set('loading');
    // A real app requests a new login token here.
    queueMicrotask(() => {
      this.token.update((t) => t + 1);
      this.status.set('active');
    });
  }
}

```


================================================================================
# COMPONENT: RADAR-CHART
================================================================================

## Documentation

# Radar chart (`<z-radar-chart>`)

Multi-axis spider and radar charts for comparing multivariate profiles across dimensions.

## Installation & Import

```tsx
// React (@zelviora/react-chart)
import { ZRadarChart } from '@zelviora/react-chart';

// Vue 3 (@zelviora/vue-chart)
import { ZRadarChart } from '@zelviora/vue-chart';

// Angular (@zelviora/angular-chart)
import { ZRadarChart } from '@zelviora/angular-chart';

// Web Components (@zelviora/chart)
import '@zelviora/chart';
```

## Key Features

- **Tree-shaken ECharts 6 Core**: Automatically registers only the required ECharts chart module and components.
- **Design System Token Synchronization**: Reads `--z-chart-series-1..8`, `--z-chart-grid-color`, and `--z-chart-axis-color`, reacting automatically to Light/Dark mode and theme preset changes.
- **Built-in Accessibility (WCAG AAA)**: Renders a semantic `<figure>` with `<figcaption>`, interactive `aria-pressed` legend toggles, and a synchronized `<table>` for screen readers.
- **Escape Hatch (`option`)**: Deep-merges any raw ECharts `option` object on top of the declarative props.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZRadarChart } from '@zelviora/angular-chart';
import { radarIndicators, radarData, radarSeries } from '../data';

@Component({
  selector: 'demo-radar-chart-basic',
  imports: [ZRadarChart],
  template: `
    <z-radar-chart
      heading="Platform Readiness Assessment"
      description="Multi-dimensional capability comparison between Release v1 and Release v2."
      xKey="metric" [indicators]="indicators" [data]="data" [series]="series"
    ></z-radar-chart>
  `,
})
export class RadarChartBasic {
  readonly indicators = radarIndicators;
  readonly data = radarData;
  readonly series = radarSeries;
}

```

### Case: controlled

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/angular';
import { ZRadarChart, type ChartPointSelectDetail, type ChartSeriesToggleDetail } from '@zelviora/angular-chart';
import { radarIndicators, radarData, radarSeries } from '../data';

@Component({
  selector: 'demo-radar-chart-controlled',
  imports: [ZStack, ZButton, ZBadge, ZText, ZRadarChart],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <z-button size="sm" variant="outline" (click)="hidden = []">
          Show All Series
        </z-button>
        <z-badge tone="primary" variant="soft">{{ selected }}</z-badge>
        <z-text variant="muted" size="sm">
          Hidden: {{ hidden.length ? hidden.join(', ') : 'none' }}
        </z-text>
      </z-stack>
      <z-radar-chart
        heading="Platform Readiness Assessment (Interactive)"
        description="Multi-dimensional capability comparison between Release v1 and Release v2."
        xKey="metric" [indicators]="indicators" [data]="data" [series]="series"
        [selectable]="true"
        [hiddenSeries]="hidden"
        (zSeriesToggle)="onToggle($event)"
        (zPointSelect)="onSelect($event)"
      ></z-radar-chart>
    </z-stack>
  `,
})
export class RadarChartControlled {
  readonly indicators = radarIndicators;
  readonly data = radarData;
  readonly series = radarSeries;
  hidden: string[] = [];
  selected = 'Click any chart element to inspect';

  onToggle(e: CustomEvent<ChartSeriesToggleDetail>) {
    this.hidden = e.detail.hiddenSeries;
  }

  onSelect(e: CustomEvent<ChartPointSelectDetail>) {
    this.selected = `Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`;
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZRadarChart } from '@zelviora/angular-chart';
import { radarIndicators, radarData, radarSeries } from '../data';

@Component({
  selector: 'demo-radar-chart-customization',
  imports: [ZRadarChart],
  template: `
    <z-radar-chart
      class="demo-chart-brand"
      description="Multi-dimensional capability comparison between Release v1 and Release v2."
      [valueFormat]="{ maximumFractionDigits: 1 }"
      xKey="metric" [indicators]="indicators" [data]="data" [series]="series" radarShape="circle" [areaOpacity]="0.4" renderer="canvas"
    >
      <span slot="heading">Platform Readiness Assessment — Custom Theme Tokens &amp; Canvas</span>
    </z-radar-chart>
  `,
})
export class RadarChartCustomization {
  readonly indicators = radarIndicators;
  readonly data = radarData;
  readonly series = radarSeries;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZRadarChart } from '@zelviora/angular-chart';
import { radarIndicators, radarData, radarSeries } from '../data';

@Component({
  selector: 'demo-radar-chart-states',
  imports: [ZStack, ZRadarChart],
  template: `
    <z-stack gap="lg">
      <z-radar-chart
        heading="Loading State (aria-busy)"
        [loading]="true"
        xKey="metric" [indicators]="indicators" [data]="data" [series]="series"
      ></z-radar-chart>
      <z-radar-chart
        heading="Empty State"
        [data]="[]"
        [series]="series"
      ></z-radar-chart>
      <z-radar-chart
        heading="Expanded Accessible Data Table"
        description="Multi-dimensional capability comparison between Release v1 and Release v2."
        [showDataTable]="true"
        xKey="metric" [indicators]="indicators" [data]="data" [series]="series"
      ></z-radar-chart>
    </z-stack>
  `,
})
export class RadarChartStates {
  readonly indicators = radarIndicators;
  readonly data = radarData;
  readonly series = radarSeries;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZRadarChart } from '@zelviora/angular-chart';
import { radarIndicators, radarData, radarSeries } from '../data';

@Component({
  selector: 'demo-radar-chart-variants',
  imports: [ZStack, ZRadarChart],
  template: `
    <z-stack gap="lg">
      <z-radar-chart
        heading="Circular Radar Grid"
        description="Circular radar web with filled area vs polygon radar outline."
        xKey="metric" [indicators]="indicators" [data]="data" [series]="series" radarShape="circle" [areaOpacity]="0.32"
      ></z-radar-chart>
      <z-radar-chart
        heading="Polygon Radar Grid"
        description="Circular radar web with filled area vs polygon radar outline."
        xKey="metric" [indicators]="indicators" [data]="data" [series]="series" radarShape="polygon" [areaOpacity]="0.1"
      ></z-radar-chart>
    </z-stack>
  `,
})
export class RadarChartVariants {
  readonly indicators = radarIndicators;
  readonly data = radarData;
  readonly series = radarSeries;
}

```


================================================================================
# COMPONENT: RADIO-GROUP
================================================================================

## Documentation

# radio-group — Angular

Processed requirements of [`<z-radio-group>` and `<z-radio-group-item>`](../../../../../requirements/04-components/form/radio-group.md)
for Angular (`@zelviora/angular`).

## Usage

```ts
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SelectValueAccessor, ZRadioGroup, ZRadioGroupItem } from '@zelviora/angular';

@Component({
  selector: 'app-shipping',
  imports: [FormsModule, SelectValueAccessor, ZRadioGroup, ZRadioGroupItem],
  template: `
    <z-radio-group name="shipping" label="Shipping method" [(ngModel)]="shipping">
      <z-radio-group-item value="standard">Standard</z-radio-group-item>
      <z-radio-group-item value="express">Express</z-radio-group-item>
    </z-radio-group>
  `,
})
export class Shipping { shipping = 'standard'; }
```

## Binding

| Value accessor | Model | Event | Detail |
|---|---|---|---|
| `SelectValueAccessor` (group) | `[(ngModel)]` / `formControl` (`string`) | `(zChange)` | `{ value }` |

Items have no model and no events.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `radio-group-default.ts` | D-1 Default, D-9 Controlled (`ngModel`), D-21 Hint per item |
| `horizontal` | `radio-group-horizontal.ts` | D-3 Variants (horizontal), D-8 Error (required) |

## Differences

- Form reset does not emit events: reset the model yourself (Reactive Forms reset through the form directive).
- Boolean and number props are bound with `[prop]="…"` (`[required]="true"`, `[maxLength]="20"`), so the value reaches the element with its type.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SelectValueAccessor, ZRadioGroup, ZRadioGroupItem, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-radio-group-default',
  imports: [FormsModule, SelectValueAccessor, ZRadioGroup, ZRadioGroupItem, ZStack],
  template: `
    <z-stack>
      <z-radio-group name="shipping" label="Shipping method" [(ngModel)]="value">
        <z-radio-group-item value="standard">Standard<span slot="hint">3–5 business days</span></z-radio-group-item>
        <z-radio-group-item value="express">Express<span slot="hint">Next business day</span></z-radio-group-item>
        <z-radio-group-item value="pickup" [disabled]="true">Store pickup</z-radio-group-item>
      </z-radio-group>
      <p>Selected: {{ value }}</p>
    </z-stack>
  `,
})
export class RadioGroupDefault {
  value = 'standard';
}

```

### Case: horizontal

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZRadioGroup, ZRadioGroupItem } from '@zelviora/angular';

@Component({
  selector: 'demo-radio-group-horizontal',
  imports: [ZRadioGroup, ZRadioGroupItem],
  template: `
    <z-radio-group name="priority" label="Priority" orientation="horizontal" [required]="true" hint="Arrow keys move and select.">
      <z-radio-group-item value="low">Low</z-radio-group-item>
      <z-radio-group-item value="medium">Medium</z-radio-group-item>
      <z-radio-group-item value="high">High</z-radio-group-item>
    </z-radio-group>
  `,
})
export class RadioGroupHorizontal {}

```


================================================================================
# COMPONENT: RANGE-SLIDER
================================================================================

## Documentation

# range-slider — Angular

Processed requirements of [`<z-range-slider>`](../../../../../requirements/04-components/form/range-slider.md) for Angular (`@zelviora/angular`).

## Usage

```ts
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SelectValueAccessor, ZRangeSlider } from '@zelviora/angular';

@Component({
  selector: 'app-price',
  imports: [FormsModule, SelectValueAccessor, ZRangeSlider],
  template: `<z-range-slider label="Price" name="price" [max]="1000" [(ngModel)]="price"></z-range-slider>`,
})
export class Price { price: [number, number] = [200, 800]; }
```

`value` is `[start, end]` (property only); in HTML use `start` / `end`. The thumbs never cross (`minDistance` keeps a
gap); the form receives two entries under the same name, start then end. Tokens are shared with the slider
(`--z-slider-*`).

## Binding

| Value accessor / prop | Model event |
|---|---|
| `SelectValueAccessor` (copies the array), `[(ngModel)]` / `formControl` (`[number, number]`) | `zInput` |

Form reset restores the default value without events; reset your state yourself.

## Events

`zInput` (`{ value, index }`, every step), `zChange` (pointer released after a change, every key).

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `range-slider-default.ts` | D-1 Default |
| `min-distance` | `range-slider-min-distance.ts` | D-21 minDistance, D-14 Long content |
| `controlled` | `range-slider-controlled.ts` | D-9 Controlled (two number-inputs) |
| `form` | `range-slider-form.ts` | D-10 In form (getAll) |
| `i18n` | `range-slider-i18n.ts` | D-19 i18n (formatValue VND) |

Not yet covered: D-6 States (coinciding thumbs), D-11 RTL, D-17 product filter.


## Examples & Implementation

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { NumericValueAccessor, SelectValueAccessor, ZGrid, ZNumberInput, ZRangeSlider, ZStack } from '@zelviora/angular';

/** The [start, end] array in a signal through ngModel (SelectValueAccessor copies the array), shared with two number-inputs. */
@Component({
  selector: 'demo-range-slider-controlled',
  imports: [FormsModule, NumericValueAccessor, SelectValueAccessor, ZGrid, ZNumberInput, ZRangeSlider, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-range-slider label="Temperature" [ngModel]="range()" (ngModelChange)="range.set($event)"></z-range-slider>
      <z-grid columns="2">
        <z-number-input label="From" [min]="0" [max]="range()[1]" [ngModel]="range()[0]" (ngModelChange)="setFrom($event)"></z-number-input>
        <z-number-input label="To" [min]="range()[0]" [max]="100" [ngModel]="range()[1]" (ngModelChange)="setTo($event)"></z-number-input>
      </z-grid>
    </z-stack>
  `,
})
export class RangeSliderControlled {
  readonly range = signal<[number, number]>([20, 60]);

  setFrom(v: number | null) {
    this.range.set([v ?? 0, this.range()[1]]);
  }

  setTo(v: number | null) {
    this.range.set([this.range()[0], v ?? 100]);
  }
}

```

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZRangeSlider, ZStack } from '@zelviora/angular';

/** Two thumbs that never cross; each thumb is a Tab stop named after the group label. */
@Component({
  selector: 'demo-range-slider-default',
  imports: [ZRangeSlider, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-range-slider label="Age" [start]="20" [end]="80" hint="Drag either thumb"></z-range-slider>
      <z-range-slider label="Hours" [min]="0" [max]="24" [start]="9" [end]="17" showValue="always"></z-range-slider>
    </z-stack>
  `,
})
export class RangeSliderDefault {}

```

### Case: form

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZRangeSlider, ZStack } from '@zelviora/angular';

/** Two FormData entries under the same name, start then end (getAll('price')). */
@Component({
  selector: 'demo-range-slider-form',
  imports: [ZButton, ZRangeSlider, ZStack],
  template: `
    <form class="demo-narrow" (submit)="submit($event)">
      <z-stack>
        <z-range-slider label="Price" name="price" [min]="0" [max]="500" [step]="10" [start]="100" [end]="300"></z-range-slider>
        <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
          <z-button type="submit">Filter</z-button>
          <z-button type="reset" variant="outline" tone="neutral">Reset</z-button>
        </z-stack>
        @if (sent()) {
          <output>{{ sent() }}</output>
        }
      </z-stack>
    </form>
  `,
})
export class RangeSliderForm {
  readonly sent = signal('');

  submit(e: Event) {
    e.preventDefault();
    this.sent.set(JSON.stringify(new FormData(e.currentTarget as HTMLFormElement).getAll('price')));
  }
}

```

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZRangeSlider } from '@zelviora/angular';

/** `lang="vi"`: values formatted as VND; minDistance keeps the thumbs at least 100.000 ₫ apart. */
@Component({
  selector: 'demo-range-slider-i18n',
  imports: [ZRangeSlider],
  template: `
    <div class="demo-narrow" lang="vi">
      <z-range-slider
        label="Khoảng giá"
        [min]="0"
        [max]="1000000"
        [step]="10000"
        [minDistance]="100000"
        [start]="200000"
        [end]="800000"
        [formatValue]="vnd"
      ></z-range-slider>
    </div>
  `,
})
export class RangeSliderI18n {
  readonly vnd = (v: number, locale: string) => new Intl.NumberFormat(locale, { style: 'currency', currency: 'VND' }).format(v);
}

```

### Case: min-distance

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZRangeSlider } from '@zelviora/angular';

/** minDistance keeps the thumbs at least $100 apart; values formatted as US dollars. */
@Component({
  selector: 'demo-range-slider-min-distance',
  imports: [ZRangeSlider],
  template: `
    <div class="demo-narrow">
      <z-range-slider
        label="Price range"
        [min]="0"
        [max]="1000"
        [step]="10"
        [minDistance]="100"
        [start]="200"
        [end]="800"
        [formatValue]="usd"
      ></z-range-slider>
    </div>
  `,
})
export class RangeSliderMinDistance {
  readonly usd = (v: number, locale: string) => new Intl.NumberFormat(locale, { style: 'currency', currency: 'USD', maximumFractionDigits: 0 }).format(v);
}

```


================================================================================
# COMPONENT: RATING
================================================================================

## Documentation

# rating — Angular

Processed requirements of [`<z-rating>`](../../../../../requirements/04-components/form/rating.md) for Angular
(`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { NumericValueAccessor, ZRating } from '@zelviora/angular';

@Component({
  selector: 'app-demo',
  imports: [FormsModule, NumericValueAccessor, ZRating],
  template: `<z-rating name="score" label="Product rating" [(ngModel)]="score"></z-rating>`,
})
export class Demo {
  score = 0;
}
```

## Binding

| Component | Value accessor | Model | Event | Detail |
|---|---|---|---|---|
| `ZRating` | `NumericValueAccessor` (spec §12: `number`) | `[(ngModel)]` / `formControl` (`number`) | `(zChange)` | `{ value }` |

Other events: `(zHoverChange)` (`{ value: number | null }`, mouse and pen preview only).
`formatLabel` is a function property; `icon` names a Material Symbols icon of the icon font (for example `favorite`; the full layer uses the filled glyph) or an icon of the registry (`registerIcons`, used by the heart demo). The default star is the filled `star` glyph, so the page needs `icons.css` of the icons package.

The accessor applies `ValidityValidator`: `required` with 0 (`valueMissing`) reach the Angular control errors.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `rating-default.ts` | D-1 Default (5 stars), D-15 Keyboard-only |
| `tones` | `rating-tones.ts` | D-4 Tones (warning, primary, destructive) |
| `sizes` | `rating-sizes.ts` | D-5 Sizes, D-14 Long content (`count=10` in a narrow column) |
| `states` | `rating-states.ts` | D-6 States, D-7 Disabled, D-20 Empty (not rated) |
| `validation` | `rating-validation.ts` | D-8 Error (required with 0) |
| `controlled` | `rating-controlled.ts` | D-9 Controlled |
| `form` | `rating-form.ts` | D-10 In form, D-17 Composition (review form) |
| `i18n` | `rating-i18n.ts` | D-19 i18n ("3,5 sao" / "3.5 stars"), D-11 RTL (half stars) |
| `customization` | `rating-customization.ts` | D-18 Customization (heart icon) |
| `half` | `rating-half.ts` | D-21 Half (`allowHalf`) |
| `display` | `rating-display.ts` | D-22 Display (`readonly` 4.3 drawn as 4.5) |

D-2 Playground, D-12 Dark, D-13 Brand showcase and D-16 Density come from the docs site switchers; D-3 Variants does not apply.

The `customization` demo uses the `demo-rating-heart` rule of `demo.css` (same rule as the React README).

## Differences

- `readonly` is a display mode (an image, not focusable), unlike the readonly of other controls.
- A rating of 0 submits nothing (no FormData entry).
- Bind boolean and number inputs with `[prop]="…"` (`[required]="true"`).
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZRating, ZStack } from '@zelviora/angular';

/** The app owns `value`: buttons set it from code (no event); hover preview and user changes are logged. */
@Component({
  selector: 'demo-rating-controlled',
  imports: [ZButton, ZRating, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-rating
        label="Service quality"
        [value]="value()"
        (zChange)="value.set($event.detail.value); add('zChange ' + $event.detail.value)"
        (zHoverChange)="add('zHoverChange ' + $event.detail.value)"
      ></z-rating>
      <z-stack orientation="horizontal" gap="sm" [wrap]="true">
        <z-button variant="outline" tone="neutral" (click)="value.set(5)">Set 5</z-button>
        <z-button variant="outline" tone="neutral" (click)="value.set(0)">Clear</z-button>
      </z-stack>
      <span>Value: {{ value() }}</span>
      <output>{{ log().join(' · ') }}</output>
    </z-stack>
  `,
})
export class RatingControlled {
  readonly value = signal(2);
  readonly log = signal<string[]>([]);

  add(line: string) {
    this.log.update((l) => [line, ...l].slice(0, 5));
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZRating, ZStack } from '@zelviora/angular';
import { registerIcons } from '@zelviora/icons';

// Trusted static SVG from the app source (never user input), 24x24 and drawn with currentColor.
registerIcons({
  'app-heart': {
    svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M12 21s-7.5-4.6-9.5-9.2C1.1 8.4 3.2 4.5 7 4.5c2 0 3.6 1.1 5 2.9 1.4-1.8 3-2.9 5-2.9 3.8 0 5.9 3.9 4.5 7.3C19.5 16.4 12 21 12 21z"/></svg>',
  },
});

/** A heart from the icon registry (`icon`) and component tokens: see the `demo-rating-heart` rule in README. */
@Component({
  selector: 'demo-rating-customization',
  imports: [ZRating, ZStack],
  template: `
    <z-stack>
      <z-rating class="demo-rating-heart" label="Favorite" icon="app-heart" [value]="4"></z-rating>
      <z-rating class="demo-rating-heart" label="Favorite (half)" icon="app-heart" [allowHalf]="true" [value]="2.5"></z-rating>
    </z-stack>
  `,
})
export class RatingCustomization {}

```

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { NumericValueAccessor, ZRating, ZStack } from '@zelviora/angular';

/**
 * Five stars: click or use the arrow keys; choosing the selected star again (or Delete) clears the rating.
 * `[(ngModel)]` through NumericValueAccessor (model event `zChange`, a number).
 */
@Component({
  selector: 'demo-rating-default',
  imports: [FormsModule, NumericValueAccessor, ZRating, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-rating label="Product rating" [(ngModel)]="value"></z-rating>
      <span>Value: {{ value }}</span>
    </z-stack>
  `,
})
export class RatingDefault {
  value = 0;
}

```

### Case: display

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZRating, ZStack } from '@zelviora/angular';

/** `readonly` shows a score as one image ("4.3 out of 5 stars"), drawn to the nearest half star; not focusable. */
@Component({
  selector: 'demo-rating-display',
  imports: [ZRating, ZStack],
  template: `
    <z-stack>
      <z-rating label="Average score" [readonly]="true" [value]="4.3"></z-rating>
      <z-rating label="No ratings yet" [readonly]="true" [value]="0"></z-rating>
    </z-stack>
  `,
})
export class RatingDisplay {}

```

### Case: form

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZCard, ZField, ZRating, ZStack, ZTextarea } from '@zelviora/angular';

/**
 * A review form: the rating is submitted as a number (no entry when 0), required inside a field; reset restores defaults.
 * FormsModule is not imported, so the form stays native and the element submits its own FormData entry.
 */
@Component({
  selector: 'demo-rating-form',
  imports: [ZButton, ZCard, ZField, ZRating, ZStack, ZTextarea],
  template: `
    <z-card heading="Order review" class="demo-narrow">
      <form (submit)="submit($event)">
        <z-stack>
          <z-field label="Product quality" [required]="true">
            <z-rating name="quality" [required]="true"></z-rating>
          </z-field>
          <z-rating name="delivery" label="Delivery" [value]="4"></z-rating>
          <z-textarea name="comment" label="Comment" [rows]="3"></z-textarea>
          <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
            <z-button type="submit">Submit</z-button>
            <z-button type="reset" variant="outline" tone="neutral">Reset</z-button>
          </z-stack>
          @if (sent()) {
            <output>{{ sent() }}</output>
          }
        </z-stack>
      </form>
    </z-card>
  `,
})
export class RatingForm {
  readonly sent = signal('');

  submit(e: Event) {
    e.preventDefault();
    this.sent.set(JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]));
  }
}

```

### Case: half

#### Angular
```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { NumericValueAccessor, ZRating, ZStack } from '@zelviora/angular';

/** `allowHalf`: one slider with steps of 0.5 (click the left or right half of a star, or use the arrow keys). */
@Component({
  selector: 'demo-rating-half',
  imports: [FormsModule, NumericValueAccessor, ZRating, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-rating label="Rating" [allowHalf]="true" [(ngModel)]="value"></z-rating>
      <span>Value: {{ value }}</span>
    </z-stack>
  `,
})
export class RatingHalf {
  value = 2.5;
}

```

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZConfigProvider, ZGrid, ZRating } from '@zelviora/angular';

/** Level names and numbers follow the locale ("3,5 sao" / "3.5 stars"); half stars follow the direction in RTL. */
@Component({
  selector: 'demo-rating-i18n',
  imports: [ZConfigProvider, ZGrid, ZRating],
  template: `
    <z-grid columns="1 sm:3" gap="md">
      <z-config-provider locale="vi">
        <z-rating label="Tiếng Việt" [allowHalf]="true" [value]="3.5"></z-rating>
      </z-config-provider>
      <z-config-provider locale="en">
        <z-rating label="English" [allowHalf]="true" [value]="3.5"></z-rating>
      </z-config-provider>
      <div dir="rtl" lang="ar-EG">
        <z-rating label="العربية" [allowHalf]="true" [value]="3.5"></z-rating>
      </div>
    </z-grid>
  `,
})
export class RatingI18n {}

```

### Case: sizes

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZRating, ZStack } from '@zelviora/angular';

/** Small, medium and large; ten levels in a narrow column wrap without overflowing. */
@Component({
  selector: 'demo-rating-sizes',
  imports: [ZRating, ZStack],
  template: `
    <z-stack>
      <z-rating label="Small" size="sm" [value]="4"></z-rating>
      <z-rating label="Medium" size="md" [value]="4"></z-rating>
      <z-rating label="Large" size="lg" [value]="4"></z-rating>
      <z-rating class="demo-narrow" label="Ten levels" [count]="10" [value]="7"></z-rating>
    </z-stack>
  `,
})
export class RatingSizes {}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGrid, ZRating } from '@zelviora/angular';

/** Empty, rated, disabled, readonly (display mode, not focusable) and invalid; hover a star to preview it. */
@Component({
  selector: 'demo-rating-states',
  imports: [ZGrid, ZRating],
  template: `
    <z-grid columns="1 sm:2" gap="md">
      <z-rating label="Empty"></z-rating>
      <z-rating label="Rated" [value]="3"></z-rating>
      <z-rating label="Disabled" [value]="3" [disabled]="true"></z-rating>
      <z-rating label="Readonly" [value]="3" [readonly]="true"></z-rating>
      <z-rating label="Invalid" [value]="3" [invalid]="true"></z-rating>
      <z-rating label="With hint" [value]="2" hint="Hover to preview, click to rate"></z-rating>
    </z-grid>
  `,
})
export class RatingStates {}

```

### Case: tones

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZRating, ZStack } from '@zelviora/angular';

/** Warning is the default (traditional yellow stars); any tone colors the selected levels. */
@Component({
  selector: 'demo-rating-tones',
  imports: [ZRating, ZStack],
  template: `
    <z-stack>
      <z-rating label="Warning" [value]="3"></z-rating>
      <z-rating label="Primary" tone="primary" [value]="3"></z-rating>
      <z-rating label="Destructive" tone="destructive" [value]="3"></z-rating>
    </z-stack>
  `,
})
export class RatingTones {}

```

### Case: validation

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZRating, ZStack } from '@zelviora/angular';

/** A required rating left at 0 is reported on submit ("Please choose a rating."). */
@Component({
  selector: 'demo-rating-validation',
  imports: [ZButton, ZRating, ZStack],
  template: `
    <form class="demo-narrow" (submit)="$event.preventDefault()">
      <z-stack>
        <z-rating name="score" label="Satisfaction" [required]="true"></z-rating>
        <z-button type="submit">Submit</z-button>
      </z-stack>
    </form>
  `,
})
export class RatingValidation {}

```


================================================================================
# COMPONENT: RESULT
================================================================================

## Documentation

# result — Angular

Processed requirements of [`<z-result>`](../../../../../requirements/04-components/data-display/result.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-result status="success" heading="Order placed" description="Order number: DH-0001">
  <z-button slot="actions">Back to home</z-button>
</z-result>
```

## Binding

No model event. Search keyword: "Result" (antd `Result`). Call `focusHeading()` when the result replaces the focused region; use `live` otherwise.

## Events

None.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `result-basic.ts` | D-1 Default |
| `statuses` | `result-statuses.ts` | D-3 Variants, D-4 Tones, D-8 Error, D-19 i18n |
| `sizes` | `result-sizes.ts` | D-5 Sizes |
| `in-form` | `result-in-form.ts` | D-10 In form, D-6 States (`live`), D-15 Keyboard-only |
| `custom` | `result-custom.ts` | D-18 Customization, D-17 Composition |


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZResult } from '@zelviora/angular';

@Component({
  selector: 'demo-result-basic',
  imports: [ZResult],
  template: `
    <z-result></z-result>
  `,
})
export class ResultBasic {}

```

### Case: custom

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZResult } from '@zelviora/angular';

@Component({
  selector: 'demo-result-custom',
  imports: [ZButton, ZResult],
  template: `
    <z-result status="404" [headingLevel]="1">
      <svg slot="icon" viewBox="0 0 64 64" width="96" height="96" fill="none" stroke="currentColor" stroke-width="2">
        <circle cx="28" cy="28" r="18" />
        <path d="M41 41l14 14M22 24h.01M34 24h.01M22 34q6-5 12 0" />
      </svg>
      <span slot="heading">Page not found</span>
      <p>The link may have changed. Check the address or try searching.</p>
      <z-button slot="actions">Go to home page</z-button>
      <z-button slot="actions" variant="ghost" tone="neutral">Report a problem</z-button>
    </z-result>
  `,
})
export class ResultCustom {}

```

### Case: in-form

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZField, ZForm, ZInput, ZResult, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-result-in-form',
  imports: [ZButton, ZField, ZForm, ZInput, ZResult, ZStack],
  template: `
    @if (order()) {
      <z-result live="polite" status="success" heading="Order placed" [description]="'Order number: ' + order()">
        <z-button slot="actions" (click)="order.set('')">Place another order</z-button>
      </z-result>
    } @else {
      <z-form [preventSubmit]="true" (zSubmit)="order.set('DH-0001')">
        <form class="demo-narrow">
          <z-stack>
            <z-field label="Email" [required]="true">
              <z-input name="email" type="email" [required]="true"></z-input>
            </z-field>
            <z-button type="submit">Place order</z-button>
          </z-stack>
        </form>
      </z-form>
    }
  `,
})
export class ResultInForm {
  readonly order = signal('');
}

```

### Case: sizes

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCard, ZGrid, ZResult } from '@zelviora/angular';

@Component({
  selector: 'demo-result-sizes',
  imports: [ZCard, ZGrid, ZResult],
  template: `
    <z-grid columns="1 md:3" gap="md">
      @for (size of sizes; track size) {
        <z-card>
          <z-result [size]="size" status="success" [headingLevel]="3" [heading]="'Size ' + size" description="Payment received."></z-result>
        </z-card>
      }
    </z-grid>
  `,
})
export class ResultSizes {
  readonly sizes = ['sm', 'md', 'lg'] as const;
}

```

### Case: statuses

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZCard, ZGrid, ZResult } from '@zelviora/angular';

@Component({
  selector: 'demo-result-statuses',
  imports: [ZButton, ZCard, ZGrid, ZResult],
  template: `
    <z-grid columns="1 md:2" gap="md">
      @for (status of statuses; track status) {
        <z-card>
          <z-result [status]="status" [headingLevel]="3">
            <z-button slot="actions" variant="outline" tone="neutral">Back to home</z-button>
          </z-result>
        </z-card>
      }
    </z-grid>
  `,
})
export class ResultStatuses {
  readonly statuses = ['success', 'error', 'warning', 'info', '403', '404', '500'] as const;
}

```


================================================================================
# COMPONENT: RICH-TEXT-EDITOR
================================================================================

## Documentation

# rich-text-editor — Angular

Processed requirements of [`<z-rich-text-editor>`](../../../../../requirements/04-components/advanced/rich-text-editor.md) for Angular (`@zelviora/angular/third-party`, optional package `@zelviora/third-party`).

## Usage

```ts
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import '@zelviora/third-party/rich-text'; // once: registers ProseMirror + DOMPurify (optional peers)
import { ThirdPartyTextValueAccessor, ZRichTextEditor } from '@zelviora/angular/third-party';

@Component({
  selector: 'app-body',
  imports: [FormsModule, ThirdPartyTextValueAccessor, ZRichTextEditor],
  template: `<z-rich-text-editor label="Body" name="body" [(ngModel)]="html"></z-rich-text-editor>`,
})
export class Body { html = ''; }
```

Install `@zelviora/third-party` and its optional peers (`prosemirror-model`, `-state`, `-view`, `-commands`, `-history`,
`-keymap`, `-schema-list`, `dompurify`; versions in its README). `value` is always sanitized HTML (`''` when empty);
`toolbar` and `allowedTags` are arrays (properties).

## Binding

| Binding | Model event |
|---|---|
| `[(ngModel)]` / `[formControl]` (`ThirdPartyTextValueAccessor`, validity reported to Angular forms) | `zInput` |

## Events

`(zInput)`, `(zChange)`, `(zPaste)` (cancelable), `(zFileInsert)` (cancelable). Setting `value` from the app emits nothing; no `zInput` while an IME composes (Telex, VNI).

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `rich-text-editor-basic.ts` | D-1 Default, D-15 Keyboard-only (shortcuts) |
| `toolbar` | `rich-text-editor-toolbar.ts` | D-3 Variants (minimal / full toolbar) |
| `states` | `rich-text-editor-states.ts` | D-6 States, D-7 Disabled |
| `controlled` | `rich-text-editor-controlled.ts` | D-9 Controlled |
| `form` | `rich-text-editor-form.ts` | D-8 Error (required, maxLength), D-10 In form, D-17 Composition (in a field) |
| `i18n` | `rich-text-editor-i18n.ts` | D-19 i18n, D-22 Vietnamese IME |
| `rtl` | `rich-text-editor-rtl.ts` | D-11 RTL (Arabic text) |
| `theme` | `rich-text-editor-theme.ts` | D-12 Dark (light and dark providers side by side) |
| `long` | `rich-text-editor-long.ts` | D-14 Long content (about 5 000 words, long URL) |
| `density` | `rich-text-editor-density.ts` | D-16 Density |
| `customization` | `rich-text-editor-customization.ts` | D-18 Customization (`toolbar-end` slot, tokens, `::part(tool)`) |
| `images` | `rich-text-editor-images.ts` | D-21 Paste / upload images (`zFileInsert` + `insertImage(url, alt)`) |

D-13 Brand showcase (accepted for v1, 2026-10-06): the docs site has no brand switcher; brands get `<prefix>-rich-text-editor` from the brand
build of the third-party package (`packages.thirdParty: true`). The `images` demo has no upload server: its stand-in
upload returns the address of a sample picture served by the docs site (`apps/document/public/demo-assets`).

Classes used by the demos (copy into the app stylesheet):

```css
.demo-rich-text-brand {
  --z-rich-text-editor-radius: var(--z-radius-lg);
  --z-rich-text-editor-border-color: var(--z-color-primary);
  --z-rich-text-editor-min-height: calc(var(--z-space-24) * 2);
}
.demo-rich-text-brand::part(tool) { color: var(--z-color-primary-text); }
.demo-rich-text-long::part(editor) { max-block-size: calc(var(--z-space-24) * 4); overflow: auto; }
```

## Security

- Client-side sanitizing is defence in depth, **not** a security boundary: anyone can POST HTML without the component.
  The server MUST sanitize `value` (HTML or JSON) again with its own allow-list before storing or showing it (OWASP XSS
  Cheat Sheet).
- `zPaste` `detail.html` is the **raw clipboard HTML, not sanitized**: never insert it into the DOM or store it without
  sanitizing. What the editor inserts itself (paste not cancelled) is always sanitized.
- Links accept only `http(s)`, `mailto` and `tel`; any other scheme (`javascript:`, `data:`, `vbscript:`…) is removed on
  **every** load path, the JSON value included (0.1.1, RICH-TEXT-EDITOR-GAP-001).
- `output-format="json"` is **experimental**: the shape is the ProseMirror document of the engine and may change or be
  removed in a `0.x` MINOR. Prefer HTML for stored content.
- Images may point to any `http(s)` URL, so content can embed external tracking pixels: restrict image origins with a
  server policy / CSP.
- `allowedTags` can only narrow the safe list, never extend it.

## Differences

- Next.js: client components only (ADR-020).
- Without the `@zelviora/third-party/rich-text` import the element shows a short message and logs an `ZPeerDependencyError`.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
// Importing `@zelviora/third-party/rich-text` once registers the editor engine and the HTML sanitizer (optional peers).
import '@zelviora/third-party/rich-text';
import { ZRichTextEditor } from '@zelviora/angular/third-party';

@Component({
  selector: 'demo-rich-text-editor-basic',
  imports: [ZRichTextEditor],
  template: `
    <div class="demo-narrow">
      <z-rich-text-editor label="Description" name="description" placeholder="Write a short description…"></z-rich-text-editor>
    </div>
  `,
})
export class RichTextEditorBasic {}

```

### Case: controlled

#### Angular
```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import '@zelviora/third-party/rich-text';
import { ZStack } from '@zelviora/angular';
import { ThirdPartyTextValueAccessor, ZRichTextEditor } from '@zelviora/angular/third-party';

/** [(ngModel)] binds value (sanitized HTML, '' when empty) through the model event zInput. */
@Component({
  selector: 'demo-rich-text-editor-controlled',
  imports: [FormsModule, ThirdPartyTextValueAccessor, ZRichTextEditor, ZStack],
  template: `
    <div class="demo-narrow">
      <z-stack>
        <z-rich-text-editor label="Message" name="message" [(ngModel)]="html"></z-rich-text-editor>
        <output>{{ html || '(empty)' }}</output>
      </z-stack>
    </div>
  `,
})
export class RichTextEditorControlled {
  html = '<p>Hello <strong>world</strong></p>';
}

```

### Case: customization

#### Angular
```typescript
import { Component, ElementRef, viewChild } from '@angular/core';
import '@zelviora/third-party/rich-text';
import { ZButton } from '@zelviora/angular';
import { ZRichTextEditor } from '@zelviora/angular/third-party';
import type { ZRichTextCommand, ZRichTextTool } from '@zelviora/third-party';

/**
 * Slotted toolbar buttons (`toolbar-end`) join the toolbar's arrow-key navigation and call `exec()`; the frame and the
 * tool buttons are restyled through component tokens and `::part(tool)` (demo-rich-text-brand).
 */
@Component({
  selector: 'demo-rich-text-editor-customization',
  imports: [ZButton, ZRichTextEditor],
  template: `
    <div class="demo-narrow">
      <z-rich-text-editor #editor class="demo-rich-text-brand" label="Release notes" [toolbar]="tools" [value]="text">
        <z-button slot="toolbar-end" size="sm" variant="ghost" tone="neutral" (click)="exec({ type: 'heading', level: 3 })">Subheading</z-button>
        <z-button slot="toolbar-end" size="sm" variant="ghost" tone="neutral" (click)="exec({ type: 'paragraph' })">Plain text</z-button>
      </z-rich-text-editor>
    </div>
  `,
})
export class RichTextEditorCustomization {
  readonly tools: ZRichTextTool[] = ['bold', 'italic', 'bulletList', 'link'];
  readonly text = '<p>Version 2.0 is out.</p>';
  private readonly editor = viewChild.required('editor', { read: ElementRef });

  exec(command: ZRichTextCommand) {
    void (this.editor().nativeElement as HTMLElement & { exec(c: ZRichTextCommand): Promise<boolean> }).exec(command);
  }
}

```

### Case: density

#### Angular
```typescript
import { Component } from '@angular/core';
import '@zelviora/third-party/rich-text';
import { ZConfigProvider, ZGrid } from '@zelviora/angular';
import { ZRichTextEditor } from '@zelviora/angular/third-party';

/** Density of the nearest config provider sets the toolbar and frame spacing. */
@Component({
  selector: 'demo-rich-text-editor-density',
  imports: [ZConfigProvider, ZGrid, ZRichTextEditor],
  template: `
    <z-grid columns="1 md:3" gap="lg">
      @for (density of densities; track density) {
        <z-config-provider [density]="density">
          <z-rich-text-editor [label]="'Density: ' + density" value="<p>Short note.</p>"></z-rich-text-editor>
        </z-config-provider>
      }
    </z-grid>
  `,
})
export class RichTextEditorDensity {
  readonly densities = ['compact', 'default', 'comfortable'] as const;
}

```

### Case: form

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import '@zelviora/third-party/rich-text';
import { ZButton, ZField, ZForm, ZStack } from '@zelviora/angular';
import { ZRichTextEditor } from '@zelviora/angular/third-party';

/** Inside a field (core) the editor (third-party build) gets the label, hint and error; it submits sanitized HTML. */
@Component({
  selector: 'demo-rich-text-editor-form',
  imports: [ZButton, ZField, ZForm, ZRichTextEditor, ZStack],
  template: `
    <z-form [summary]="true" [preventSubmit]="true" (zSubmit)="sent.set(stringify($event.detail.values))">
      <form class="demo-narrow">
        <z-stack>
          <z-field label="Product description" hint="At most 200 characters" [required]="true">
            <z-rich-text-editor name="body" [required]="true" [maxLength]="200"></z-rich-text-editor>
          </z-field>
          <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
            <z-button type="submit">Save</z-button>
            <z-button type="reset" variant="outline" tone="neutral">Reset</z-button>
          </z-stack>
          @if (sent()) {
            <output>{{ sent() }}</output>
          }
        </z-stack>
      </form>
    </z-form>
  `,
})
export class RichTextEditorForm {
  readonly sent = signal('');
  readonly stringify = (value: unknown) => JSON.stringify(value);
}

```

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import '@zelviora/third-party/rich-text';
import { ZConfigProvider } from '@zelviora/angular';
import { ZRichTextEditor } from '@zelviora/angular/third-party';

/** Tool labels and messages follow the locale; Vietnamese input methods (Telex, VNI) compose without losing characters. */
@Component({
  selector: 'demo-rich-text-editor-i18n',
  imports: [ZConfigProvider, ZRichTextEditor],
  template: `
    <z-config-provider locale="vi">
      <div class="demo-narrow">
        <z-rich-text-editor label="Nội dung" [maxLength]="120" placeholder="Gõ tiếng Việt (Telex, VNI)…" [value]="greeting"></z-rich-text-editor>
      </div>
    </z-config-provider>
  `,
})
export class RichTextEditorI18n {
  readonly greeting = '<p>Xin chào!</p>';
}

```

### Case: images

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import '@zelviora/third-party/rich-text';
import { ZStack } from '@zelviora/angular';
import { ZRichTextEditor } from '@zelviora/angular/third-party';

type Editor = HTMLElement & { insertImage(src: string, alt?: string): Promise<void> };

/** Sample picture served by the docs site (apps/document/public): the address an upload API would return. */
const SAMPLE = '/demo-assets/rich-text-sample.svg';
const START = `<p>Mountains under a yellow sun:</p><p><img src="${SAMPLE}" alt="Blue mountains under a yellow sun"></p>`;

/** Stand-in for the app's upload API (this demo has no server): every file "uploads" to the sample picture. */
const upload = async (_file: File) => SAMPLE;

/**
 * Paste or drop an image: the editor never inlines files; it emits zFileInsert, the app uploads each image and calls
 * `insertImage(url, alt)` with the returned address (unsafe addresses such as `javascript:` or `data:` are ignored).
 */
@Component({
  selector: 'demo-rich-text-editor-images',
  imports: [ZRichTextEditor, ZStack],
  template: `
    <div class="demo-narrow">
      <z-stack>
        <z-rich-text-editor label="Post" placeholder="Paste or drop an image here…" [value]="start" (zFileInsert)="insert($event)"></z-rich-text-editor>
        <output>{{ log().length ? log().join(' · ') : 'No file yet' }}</output>
      </z-stack>
    </div>
  `,
})
export class RichTextEditorImages {
  readonly log = signal<string[]>([]);
  readonly start = START;

  async insert(e: CustomEvent<{ files: File[] }>) {
    const editor = e.target as Editor;
    for (const file of e.detail.files) {
      if (!file.type.startsWith('image/')) { this.log.update((l) => [`${file.name}: skipped (not an image)`, ...l]); continue; }
      const url = await upload(file);
      await editor.insertImage(url, file.name);
      this.log.update((l) => [`${file.name} (${Math.round(file.size / 1024)} kB) → ${url}`, ...l]);
    }
  }
}

```

### Case: long

#### Angular
```typescript
import { Component } from '@angular/core';
import '@zelviora/third-party/rich-text';
import { ZRichTextEditor } from '@zelviora/angular/third-party';
import { longDocument } from '../data';

/** About 5 000 words and a long URL without spaces; the editing area scrolls (demo-rich-text-long, ::part(editor)). */
@Component({
  selector: 'demo-rich-text-editor-long',
  imports: [ZRichTextEditor],
  template: `<z-rich-text-editor class="demo-rich-text-long" label="Annual report" [value]="text"></z-rich-text-editor>`,
})
export class RichTextEditorLong {
  readonly text = longDocument;
}

```

### Case: rtl

#### Angular
```typescript
import { Component } from '@angular/core';
import '@zelviora/third-party/rich-text';
import { ZRichTextEditor } from '@zelviora/angular/third-party';
import { arabicText } from '../data';

/** RTL: the toolbar and the text start on the right; arrow keys in the toolbar follow the reading order. */
@Component({
  selector: 'demo-rich-text-editor-rtl',
  imports: [ZRichTextEditor],
  template: `
    <div dir="rtl" lang="ar" class="demo-narrow">
      <z-rich-text-editor label="المحتوى" [value]="text"></z-rich-text-editor>
    </div>
  `,
})
export class RichTextEditorRtl {
  readonly text = arabicText;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import '@zelviora/third-party/rich-text';
import { ZStack } from '@zelviora/angular';
import { ZRichTextEditor } from '@zelviora/angular/third-party';

/** Disabled: no editing and out of the tab order. Read-only: the text can be selected and copied, not changed. */
@Component({
  selector: 'demo-rich-text-editor-states',
  imports: [ZRichTextEditor, ZStack],
  template: `
    <div class="demo-narrow">
      <z-stack>
        <z-rich-text-editor label="Disabled" [disabled]="true" [value]="disabledText"></z-rich-text-editor>
        <z-rich-text-editor label="Read-only" [readonly]="true" [value]="readonlyText"></z-rich-text-editor>
      </z-stack>
    </div>
  `,
})
export class RichTextEditorStates {
  readonly disabledText = '<p>Nothing to change here.</p>';
  readonly readonlyText = '<p>Select and copy <em>this</em> text.</p>';
}

```

### Case: theme

#### Angular
```typescript
import { Component } from '@angular/core';
import '@zelviora/third-party/rich-text';
import { ZCard, ZConfigProvider, ZGrid, ZGridItem } from '@zelviora/angular';
import { ZRichTextEditor } from '@zelviora/angular/third-party';

/** Light and dark side by side: the frame, toolbar and text colors come from tokens. */
@Component({
  selector: 'demo-rich-text-editor-theme',
  imports: [ZCard, ZConfigProvider, ZGrid, ZGridItem, ZRichTextEditor],
  template: `
    <z-grid columns="1 md:2" gap="lg">
      <z-grid-item>
        <z-config-provider theme="light">
          <z-card><z-rich-text-editor label="Light" [value]="text"></z-rich-text-editor></z-card>
        </z-config-provider>
      </z-grid-item>
      <z-grid-item>
        <z-config-provider theme="dark">
          <z-card><z-rich-text-editor label="Dark" [value]="text"></z-rich-text-editor></z-card>
        </z-config-provider>
      </z-grid-item>
    </z-grid>
  `,
})
export class RichTextEditorTheme {
  readonly text = '<p>Some <strong>bold</strong>, <em>italic</em> and <a href="https://example.com">a link</a>.</p>';
}

```

### Case: toolbar

#### Angular
```typescript
import { Component } from '@angular/core';
import '@zelviora/third-party/rich-text';
import type { ZRichTextTool } from '@zelviora/third-party';
import { ZStack } from '@zelviora/angular';
import { ZRichTextEditor } from '@zelviora/angular/third-party';

/** The toolbar lists the tools in order; Alt+F10 moves to it and the arrow keys move between tools. */
@Component({
  selector: 'demo-rich-text-editor-toolbar',
  imports: [ZRichTextEditor, ZStack],
  template: `
    <div class="demo-narrow">
      <z-stack>
        <z-rich-text-editor label="Comment (minimal toolbar)" [toolbar]="minimal"></z-rich-text-editor>
        <z-rich-text-editor label="Article (full toolbar)" [toolbar]="full" [value]="article"></z-rich-text-editor>
      </z-stack>
    </div>
  `,
})
export class RichTextEditorToolbar {
  readonly minimal: ZRichTextTool[] = ['bold', 'italic', 'link'];
  readonly full: ZRichTextTool[] = ['bold', 'italic', 'underline', 'strike', 'code', 'separator', 'heading', 'bulletList', 'orderedList', 'blockquote', 'separator', 'link', 'separator', 'undo', 'redo'];
  readonly article = '<h2>Title</h2><p>Some <strong>bold</strong> and <code>code</code>.</p>';
}

```


================================================================================
# COMPONENT: SANKEY-CHART
================================================================================

## Documentation

# Sankey chart (`<z-sankey-chart>`)

Directed flow diagram where link ribbon width encodes flow quantity between nodes.

## Installation & Import

```tsx
// React (@zelviora/react-chart)
import { ZSankeyChart } from '@zelviora/react-chart';

// Vue 3 (@zelviora/vue-chart)
import { ZSankeyChart } from '@zelviora/vue-chart';

// Angular (@zelviora/angular-chart)
import { ZSankeyChart } from '@zelviora/angular-chart';

// Web Components (@zelviora/chart)
import '@zelviora/chart';
```

## Key Features

- **Tree-shaken ECharts 6 Core**: Automatically registers only the required ECharts chart module and components.
- **Design System Token Synchronization**: Reads `--z-chart-series-1..8`, `--z-chart-grid-color`, and `--z-chart-axis-color`, reacting automatically to Light/Dark mode and theme preset changes.
- **Built-in Accessibility (WCAG AAA)**: Renders a semantic `<figure>` with `<figcaption>`, interactive `aria-pressed` legend toggles, and a synchronized `<table>` for screen readers.
- **Escape Hatch (`option`)**: Deep-merges any raw ECharts `option` object on top of the declarative props.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZSankeyChart } from '@zelviora/angular-chart';
import { sankeyNodes, sankeyLinks, sankeySeries } from '../data';

@Component({
  selector: 'demo-sankey-chart-basic',
  imports: [ZSankeyChart],
  template: `
    <z-sankey-chart
      heading="User Acquisition to Conversion Flow"
      description="Flow of sessions from acquisition channels through product onboarding to paid plans."
      [nodes]="nodes" [links]="links" [series]="series"
    ></z-sankey-chart>
  `,
})
export class SankeyChartBasic {
  readonly nodes = sankeyNodes;
  readonly links = sankeyLinks;
  readonly series = sankeySeries;
}

```

### Case: controlled

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/angular';
import { ZSankeyChart, type ChartPointSelectDetail, type ChartSeriesToggleDetail } from '@zelviora/angular-chart';
import { sankeyNodes, sankeyLinks, sankeySeries } from '../data';

@Component({
  selector: 'demo-sankey-chart-controlled',
  imports: [ZStack, ZButton, ZBadge, ZText, ZSankeyChart],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <z-button size="sm" variant="outline" (click)="hidden = []">
          Show All Series
        </z-button>
        <z-badge tone="primary" variant="soft">{{ selected }}</z-badge>
        <z-text variant="muted" size="sm">
          Hidden: {{ hidden.length ? hidden.join(', ') : 'none' }}
        </z-text>
      </z-stack>
      <z-sankey-chart
        heading="User Acquisition to Conversion Flow (Interactive)"
        description="Flow of sessions from acquisition channels through product onboarding to paid plans."
        [nodes]="nodes" [links]="links" [series]="series"
        [selectable]="true"
        [hiddenSeries]="hidden"
        (zSeriesToggle)="onToggle($event)"
        (zPointSelect)="onSelect($event)"
      ></z-sankey-chart>
    </z-stack>
  `,
})
export class SankeyChartControlled {
  readonly nodes = sankeyNodes;
  readonly links = sankeyLinks;
  readonly series = sankeySeries;
  hidden: string[] = [];
  selected = 'Click any chart element to inspect';

  onToggle(e: CustomEvent<ChartSeriesToggleDetail>) {
    this.hidden = e.detail.hiddenSeries;
  }

  onSelect(e: CustomEvent<ChartPointSelectDetail>) {
    this.selected = `Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`;
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZSankeyChart } from '@zelviora/angular-chart';
import { sankeyNodes, sankeyLinks, sankeySeries } from '../data';

@Component({
  selector: 'demo-sankey-chart-customization',
  imports: [ZSankeyChart],
  template: `
    <z-sankey-chart
      class="demo-chart-brand"
      description="Flow of sessions from acquisition channels through product onboarding to paid plans."
      [valueFormat]="{ maximumFractionDigits: 1 }"
      [nodes]="nodes" [links]="links" [series]="series" nodeAlign="right" renderer="canvas"
    >
      <span slot="heading">User Acquisition to Conversion Flow — Custom Theme Tokens &amp; Canvas</span>
    </z-sankey-chart>
  `,
})
export class SankeyChartCustomization {
  readonly nodes = sankeyNodes;
  readonly links = sankeyLinks;
  readonly series = sankeySeries;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZSankeyChart } from '@zelviora/angular-chart';
import { sankeyNodes, sankeyLinks, sankeySeries } from '../data';

@Component({
  selector: 'demo-sankey-chart-states',
  imports: [ZStack, ZSankeyChart],
  template: `
    <z-stack gap="lg">
      <z-sankey-chart
        heading="Loading State (aria-busy)"
        [loading]="true"
        [nodes]="nodes" [links]="links" [series]="series"
      ></z-sankey-chart>
      <z-sankey-chart
        heading="Empty State"
        [nodes]="[]" [links]="[]"
        [series]="series"
      ></z-sankey-chart>
      <z-sankey-chart
        heading="Expanded Accessible Data Table"
        description="Flow of sessions from acquisition channels through product onboarding to paid plans."
        [showDataTable]="true"
        [nodes]="nodes" [links]="links" [series]="series"
      ></z-sankey-chart>
    </z-stack>
  `,
})
export class SankeyChartStates {
  readonly nodes = sankeyNodes;
  readonly links = sankeyLinks;
  readonly series = sankeySeries;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZSankeyChart } from '@zelviora/angular-chart';
import { sankeyNodes, sankeyLinks, sankeySeries } from '../data';

@Component({
  selector: 'demo-sankey-chart-variants',
  imports: [ZStack, ZSankeyChart],
  template: `
    <z-stack gap="lg">
      <z-sankey-chart
        heading="Left-Aligned Horizontal Sankey"
        description="Left-aligned horizontal flow vs top-to-bottom vertical Sankey flow."
        [nodes]="nodes" [links]="links" [series]="series" nodeAlign="left" sankeyOrient="horizontal"
      ></z-sankey-chart>
      <z-sankey-chart
        heading="Vertical Flow Sankey"
        description="Left-aligned horizontal flow vs top-to-bottom vertical Sankey flow."
        [nodes]="nodes" [links]="links" [series]="series" sankeyOrient="vertical" nodeAlign="justify"
      ></z-sankey-chart>
    </z-stack>
  `,
})
export class SankeyChartVariants {
  readonly nodes = sankeyNodes;
  readonly links = sankeyLinks;
  readonly series = sankeySeries;
}

```


================================================================================
# COMPONENT: SCATTER-CHART
================================================================================

## Documentation

# Scatter chart (`<z-scatter-chart>`)

Cartesian coordinate scatter and bubble distribution charts powered by ECharts ScatterChart.

## Installation & Import

```tsx
// React (@zelviora/react-chart)
import { ZScatterChart } from '@zelviora/react-chart';

// Vue 3 (@zelviora/vue-chart)
import { ZScatterChart } from '@zelviora/vue-chart';

// Angular (@zelviora/angular-chart)
import { ZScatterChart } from '@zelviora/angular-chart';

// Web Components (@zelviora/chart)
import '@zelviora/chart';
```

## Key Features

- **Tree-shaken ECharts 6 Core**: Automatically registers only the required ECharts chart module and components.
- **Design System Token Synchronization**: Reads `--z-chart-series-1..8`, `--z-chart-grid-color`, and `--z-chart-axis-color`, reacting automatically to Light/Dark mode and theme preset changes.
- **Built-in Accessibility (WCAG AAA)**: Renders a semantic `<figure>` with `<figcaption>`, interactive `aria-pressed` legend toggles, and a synchronized `<table>` for screen readers.
- **Escape Hatch (`option`)**: Deep-merges any raw ECharts `option` object on top of the declarative props.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZScatterChart } from '@zelviora/angular-chart';
import { latencyData, latencySeries } from '../data';

@Component({
  selector: 'demo-scatter-chart-basic',
  imports: [ZScatterChart],
  template: `
    <z-scatter-chart
      heading="API Response Time vs Payload Size"
      description="Median (p50) and 95th percentile (p95) latency across payload sizes from 10 kB to 320 kB."
      xKey="payloadKb" [data]="data" [series]="series"
    ></z-scatter-chart>
  `,
})
export class ScatterChartBasic {
  readonly data = latencyData;
  readonly series = latencySeries;
}

```

### Case: controlled

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/angular';
import { ZScatterChart, type ChartPointSelectDetail, type ChartSeriesToggleDetail } from '@zelviora/angular-chart';
import { latencyData, latencySeries } from '../data';

@Component({
  selector: 'demo-scatter-chart-controlled',
  imports: [ZStack, ZButton, ZBadge, ZText, ZScatterChart],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <z-button size="sm" variant="outline" (click)="hidden = []">
          Show All Series
        </z-button>
        <z-badge tone="primary" variant="soft">{{ selected }}</z-badge>
        <z-text variant="muted" size="sm">
          Hidden: {{ hidden.length ? hidden.join(', ') : 'none' }}
        </z-text>
      </z-stack>
      <z-scatter-chart
        heading="API Response Time vs Payload Size (Interactive)"
        description="Median (p50) and 95th percentile (p95) latency across payload sizes from 10 kB to 320 kB."
        xKey="payloadKb" [data]="data" [series]="series"
        [selectable]="true"
        [hiddenSeries]="hidden"
        (zSeriesToggle)="onToggle($event)"
        (zPointSelect)="onSelect($event)"
      ></z-scatter-chart>
    </z-stack>
  `,
})
export class ScatterChartControlled {
  readonly data = latencyData;
  readonly series = latencySeries;
  hidden: string[] = [];
  selected = 'Click any chart element to inspect';

  onToggle(e: CustomEvent<ChartSeriesToggleDetail>) {
    this.hidden = e.detail.hiddenSeries;
  }

  onSelect(e: CustomEvent<ChartPointSelectDetail>) {
    this.selected = `Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`;
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZScatterChart } from '@zelviora/angular-chart';
import { latencyData, latencySeries } from '../data';

@Component({
  selector: 'demo-scatter-chart-customization',
  imports: [ZScatterChart],
  template: `
    <z-scatter-chart
      class="demo-chart-brand"
      description="Median (p50) and 95th percentile (p95) latency across payload sizes from 10 kB to 320 kB."
      [valueFormat]="{ maximumFractionDigits: 1 }"
      xKey="payloadKb" [data]="data" [series]="series" [dataZoom]="true" [symbolSize]="14" renderer="canvas"
    >
      <span slot="heading">API Response Time vs Payload Size — Custom Theme Tokens &amp; Canvas</span>
    </z-scatter-chart>
  `,
})
export class ScatterChartCustomization {
  readonly data = latencyData;
  readonly series = latencySeries;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZScatterChart } from '@zelviora/angular-chart';
import { latencyData, latencySeries } from '../data';

@Component({
  selector: 'demo-scatter-chart-states',
  imports: [ZStack, ZScatterChart],
  template: `
    <z-stack gap="lg">
      <z-scatter-chart
        heading="Loading State (aria-busy)"
        [loading]="true"
        xKey="payloadKb" [data]="data" [series]="series"
      ></z-scatter-chart>
      <z-scatter-chart
        heading="Empty State"
        [data]="[]"
        [series]="series"
      ></z-scatter-chart>
      <z-scatter-chart
        heading="Expanded Accessible Data Table"
        description="Median (p50) and 95th percentile (p95) latency across payload sizes from 10 kB to 320 kB."
        [showDataTable]="true"
        xKey="payloadKb" [data]="data" [series]="series"
      ></z-scatter-chart>
    </z-stack>
  `,
})
export class ScatterChartStates {
  readonly data = latencyData;
  readonly series = latencySeries;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZScatterChart } from '@zelviora/angular-chart';
import { latencyData, latencySeries } from '../data';

@Component({
  selector: 'demo-scatter-chart-variants',
  imports: [ZStack, ZScatterChart],
  template: `
    <z-stack gap="lg">
      <z-scatter-chart
        heading="Bubble Size Dimension"
        description="Bubble sizing driven by a data dimension (sizeKey) vs compact uniform markers."
        xKey="payloadKb" [data]="data" [series]="series" sizeKey="weight" [symbolSize]="18"
      ></z-scatter-chart>
      <z-scatter-chart
        heading="Compact Point Markers"
        description="Bubble sizing driven by a data dimension (sizeKey) vs compact uniform markers."
        xKey="payloadKb" [data]="data" [series]="series" [symbolSize]="8" tooltipMode="point"
      ></z-scatter-chart>
    </z-stack>
  `,
})
export class ScatterChartVariants {
  readonly data = latencyData;
  readonly series = latencySeries;
}

```


================================================================================
# COMPONENT: SCROLL-AREA
================================================================================

## Documentation

# scroll-area — Angular

Processed requirements of `z-scroll-area` ([spec](../../../../../requirements/04-components/base/scroll-area.md)) for Angular
(`@zelviora/angular`).

## Binding and events

| Input | Output | Detail |
|---|---|---|
| — | `(zScroll)`, `(zScrollEnd)` | `{ scrollTop, scrollLeft, atStart, atEnd }`, `{ scrollTop, scrollLeft }` |

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `scroll-area-default.ts` | D-1 Default, D-15 Keyboard-only, D-9 Controlled (event log) |
| `horizontal` | `scroll-area-horizontal.ts` | D-14 Long content, D-11 RTL (thanh dọc bên trái khi `dir="rtl"`) |
| `fade-edges` | `scroll-area-fade-edges.ts` | D-3 Variants, D-18 Customization |

## Demo classes

The demos use this rule of `src/styles/demo.css` (copy it into the app stylesheet):

```css
/* Fixed height of a scroll area demo (the app gives the area its size). */
.demo-scroll-area {
  block-size: calc(var(--z-space-24) * 2.5);
}
```

## Differences

- Bind booleans with `[prop]="true"`; plain attributes are strings.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: default

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZScrollArea, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-scroll-area-default',
  imports: [ZScrollArea, ZStack],
  template: `
    <z-stack gap="sm" class="demo-narrow">
      <z-scroll-area label="Branches" class="demo-scroll-area" (zScrollEnd)="top.set($event.detail.scrollTop)">
        @for (b of branches; track b) {
          <p>{{ b }}</p>
        }
      </z-scroll-area>
      <p>Scrolled to: {{ top() }}px</p>
    </z-stack>
  `,
})
export class ScrollAreaDefault {
  readonly branches = Array.from({ length: 50 }, (_, i) => `Branch ${i + 1}`);
  readonly top = signal(0);
}

```

### Case: fade-edges

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZScrollArea } from '@zelviora/angular';

@Component({
  selector: 'demo-scroll-area-fade-edges',
  imports: [ZScrollArea],
  template: `
    <z-scroll-area scrollbar="hidden" [fadeEdges]="true" label="Notifications" class="demo-scroll-area demo-narrow">
      @for (l of lines; track l) {
        <p>{{ l }}</p>
      }
    </z-scroll-area>
  `,
})
export class ScrollAreaFadeEdges {
  readonly lines = Array.from({ length: 30 }, (_, i) => `Notification ${i + 1}`);
}

```

### Case: horizontal

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZScrollArea, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-scroll-area-horizontal',
  imports: [ZBadge, ZScrollArea, ZStack],
  template: `
    <z-scroll-area orientation="horizontal" label="Tags" class="demo-narrow">
      <z-stack orientation="horizontal" gap="sm">
        @for (t of tags; track t) {
          <z-badge>{{ t }}</z-badge>
        }
      </z-stack>
    </z-scroll-area>
  `,
})
export class ScrollAreaHorizontal {
  readonly tags = Array.from({ length: 30 }, (_, i) => `Tag ${i + 1}`);
}

```


================================================================================
# COMPONENT: SEGMENTED
================================================================================

## Documentation

# segmented — Angular

Processed requirements of `z-segmented` and `z-segmented-item` ([spec](../../../../../requirements/04-components/form/segmented.md)) for Angular
(`@zelviora/angular`).

## Binding and events

| Input | Output | Detail |
|---|---|---|
| `[(ngModel)]` / `[formControl]` (`SelectValueAccessor`), or `[value]` | `(zChange)` | `{ value }` |

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `segmented-default.ts` | D-1 Default, D-9 Controlled, D-15 Keyboard-only |
| `icon-only` | `segmented-icon-only.ts` | D-21 Icon only, D-5 Sizes (sm) |
| `block` | `segmented-block.ts` | D-14 Long content, D-7 Disabled (item) |
| `in-form` | `segmented-in-form.ts` | D-10 In form, D-8 Error |

## Differences

- Bind booleans with `[prop]="true"`; plain attributes are strings.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: block

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZSegmented, ZSegmentedItem } from '@zelviora/angular';

@Component({
  selector: 'demo-segmented-block',
  imports: [ZSegmented, ZSegmentedItem],
  template: `
    <z-segmented label="Delivery" [block]="true" defaultValue="standard">
      <z-segmented-item value="standard">Standard delivery (3–5 business days)</z-segmented-item>
      <z-segmented-item value="express">Express delivery (next business day)</z-segmented-item>
      <z-segmented-item value="pickup" [disabled]="true">Store pickup</z-segmented-item>
    </z-segmented>
  `,
})
export class SegmentedBlock {}

```

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SelectValueAccessor, ZSegmented, ZSegmentedItem, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-segmented-default',
  imports: [FormsModule, SelectValueAccessor, ZSegmented, ZSegmentedItem, ZStack],
  template: `
    <z-stack gap="sm">
      <z-segmented label="Calendar view" [(ngModel)]="value">
        <z-segmented-item value="day">Day</z-segmented-item>
        <z-segmented-item value="week">Week</z-segmented-item>
        <z-segmented-item value="month">Month</z-segmented-item>
      </z-segmented>
      <p>View: {{ value }}</p>
    </z-stack>
  `,
})
export class SegmentedDefault {
  value = 'week';
}

```

### Case: icon-only

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZIcon, ZSegmented, ZSegmentedItem } from '@zelviora/angular';

@Component({
  selector: 'demo-segmented-icon-only',
  imports: [ZIcon, ZSegmented, ZSegmentedItem],
  template: `
    <z-segmented label="Layout" size="sm" defaultValue="grid">
      <z-segmented-item value="grid" label="Grid"><z-icon slot="icon" name="grid_view"></z-icon></z-segmented-item>
      <z-segmented-item value="list" label="List"><z-icon slot="icon" name="view_list"></z-icon></z-segmented-item>
    </z-segmented>
  `,
})
export class SegmentedIconOnly {}

```

### Case: in-form

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZSegmented, ZSegmentedItem, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-segmented-in-form',
  imports: [ZButton, ZSegmented, ZSegmentedItem, ZStack],
  template: `
    <form (submit)="submit($event)">
      <z-stack gap="sm" align-items="start">
        <z-segmented name="period" label="Billing period" [required]="true">
          <z-segmented-item value="monthly">Monthly</z-segmented-item>
          <z-segmented-item value="yearly">Yearly</z-segmented-item>
        </z-segmented>
        <z-stack orientation="horizontal" gap="sm">
          <z-button type="submit">Submit</z-button>
          <z-button type="reset" variant="outline" tone="neutral">Reset</z-button>
        </z-stack>
        <p>Submitted: {{ sent() || '—' }}</p>
      </z-stack>
    </form>
  `,
})
export class SegmentedInForm {
  readonly sent = signal('');

  submit(e: Event) {
    e.preventDefault();
    this.sent.set(String(new FormData(e.currentTarget as HTMLFormElement).get('period')));
  }
}

```


================================================================================
# COMPONENT: SELECT
================================================================================

## Documentation

# select — Angular

Processed requirements of [`<z-select>`, `<z-select-option>` and `<z-select-group>`](../../../../../requirements/04-components/form/select.md)
for Angular (`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SelectValueAccessor, ZSelect, ZSelectOption } from '@zelviora/angular';

@Component({
  selector: 'app-city',
  imports: [FormsModule, SelectValueAccessor, ZSelect, ZSelectOption],
  template: `
    <z-select name="city" label="City" [(ngModel)]="city">
      <z-select-option value="hn">Hanoi</z-select-option>
      <z-select-option value="hcm">Ho Chi Minh City</z-select-option>
    </z-select>
  `,
})
export class City { city: string | null = null; }
```

## Binding

| Component | Value accessor | Model | Event | Detail |
|---|---|---|---|---|
| `ZSelect` | `SelectValueAccessor` | `[(ngModel)]` / `formControl` (`string \| null`, multiple: `string[]`) | `(zChange)` | `{ value, option }` |
| `ZSelect` | — | `[open]` (no two-way binding, D-031) | `(zOpenChange)` | `{ open, reason }` |

## Events

`(zChange)`, `(zOpenChange)`, `(zBeforeOpen)` / `(zBeforeClose)` (cancelable), `(zClear)`, `(zLoadMore)`, `(zAfterOpen)`, `(zAfterClose)`.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `select-default.ts` | D-1 Default, D-7 Disabled (option), D-9 Controlled, D-15 Keyboard (typeahead), D-22 Groups & descriptions |
| `multiple` | `select-multiple.ts` | D-21 Multiple, D-3 Variants (filled), D-5 Sizes |
| `form` | `select-form.ts` | D-10 In form, D-8 Error (required), D-17 Composition (field) |
| `data` | `select-data.ts` | D-23 Data-driven, D-24 Async, D-20 Empty / loading |

## Differences

- Boolean and number props are bound with `[prop]="…"` (`[loading]="true"`), so the value reaches the element with its type.
- The form demo keeps a native `<form>` (FormsModule not imported) so a multiple select submits one `FormData` entry per value; with FormsModule bind `[(ngModel)]` / `formControl` instead.
- With `[(ngModel)]` / `formControl`, `SelectValueAccessor` applies `ValidityValidator`: `required` on the element makes the Angular control invalid while empty (error `required`, plus `zValidity`).
- Options show their label and description only (no rich content, spec §4.4).
- `virtual` (`auto` above 200 options, `on`, `off`) renders only the options in view; `(zLoadMore)` works with or without it.
- Form reset does not emit events: reset the model yourself.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: data

#### Angular
```typescript
import { Component, type OnDestroy, type OnInit, signal } from '@angular/core';
import { ZSelect, ZStack } from '@zelviora/angular';
import type { ZSelectOptionData } from '@zelviora/core';

const PLANS: ZSelectOptionData[] = [
  { value: 'free', label: 'Free', description: 'For trying things out', group: 'Personal' },
  { value: 'pro', label: 'Pro', description: 'For individuals', group: 'Personal' },
  { value: 'team', label: 'Team', description: 'Up to 20 seats', group: 'Business' },
  { value: 'enterprise', label: 'Enterprise', description: 'Contact sales', group: 'Business', disabled: true },
];

/** Options as data (`options`), loaded after a delay: the initial value shows once its option arrives. */
@Component({
  selector: 'demo-select-data',
  imports: [ZSelect, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-select label="Plan" [options]="options()" [loading]="loading()" value="pro"></z-select>
      <z-select label="Empty list" [options]="[]" placeholder="No plan available"></z-select>
    </z-stack>
  `,
})
export class SelectData implements OnInit, OnDestroy {
  readonly options = signal<ZSelectOptionData[]>([]);
  readonly loading = signal(true);
  private timer?: ReturnType<typeof setTimeout>;

  ngOnInit() {
    this.timer = setTimeout(() => {
      this.options.set(PLANS);
      this.loading.set(false);
    }, 1000);
  }

  ngOnDestroy() {
    clearTimeout(this.timer);
  }
}

```

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SelectValueAccessor, ZSelect, ZSelectGroup, ZSelectOption, ZStack } from '@zelviora/angular';

/** `[(ngModel)]` through SelectValueAccessor (model event `zChange`); clearing sets the model to null. */
@Component({
  selector: 'demo-select-default',
  imports: [FormsModule, SelectValueAccessor, ZSelect, ZSelectGroup, ZSelectOption, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-select label="City" hint="Type a letter to jump to a city" [clearable]="true" [(ngModel)]="city">
        <z-select-group label="North">
          <z-select-option value="hn">Hanoi</z-select-option>
          <z-select-option value="hp">Hai Phong</z-select-option>
        </z-select-group>
        <z-select-group label="Central">
          <z-select-option value="hue">Hue</z-select-option>
          <z-select-option value="dn" [disabled]="true">Da Nang</z-select-option>
        </z-select-group>
        <z-select-option value="hcm" description="Largest city">Ho Chi Minh City</z-select-option>
      </z-select>
      <span>Selected: {{ city ?? 'none' }}</span>
    </z-stack>
  `,
})
export class SelectDefault {
  city: string | null = 'hue';
}

```

### Case: form

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZField, ZSelect, ZSelectOption, ZStack } from '@zelviora/angular';

/**
 * Native form: required single select inside a field, multiple select with several FormData entries, reset.
 * FormsModule is not imported, so the form stays native and the element submits its own FormData entries.
 */
@Component({
  selector: 'demo-select-form',
  imports: [ZButton, ZField, ZSelect, ZSelectOption, ZStack],
  template: `
    <form class="demo-narrow" (submit)="submit($event)">
      <z-stack>
        <z-field label="Country" [required]="true">
          <z-select name="country" [required]="true">
            <z-select-option value="vn">Vietnam</z-select-option>
            <z-select-option value="th">Thailand</z-select-option>
            <z-select-option value="sg">Singapore</z-select-option>
          </z-select>
        </z-field>
        <z-select name="lang" label="Languages" [multiple]="true">
          <z-select-option value="vi" [selected]="true">Vietnamese</z-select-option>
          <z-select-option value="en" [selected]="true">English</z-select-option>
          <z-select-option value="fr">French</z-select-option>
        </z-select>
        <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
          <z-button type="submit">Submit</z-button>
          <z-button type="reset" variant="outline" tone="neutral">Reset</z-button>
        </z-stack>
        @if (sent()) {
          <output>{{ sent() }}</output>
        }
      </z-stack>
    </form>
  `,
})
export class SelectForm {
  readonly sent = signal('');

  submit(e: Event) {
    e.preventDefault();
    this.sent.set(JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]));
  }
}

```

### Case: multiple

#### Angular
```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SelectValueAccessor, ZSelect, ZSelectOption, ZStack } from '@zelviora/angular';

const TOPPINGS = ['Cheese', 'Mushroom', 'Olive', 'Onion', 'Pepper', 'Tomato'];

@Component({
  selector: 'demo-select-multiple',
  imports: [FormsModule, SelectValueAccessor, ZSelect, ZSelectOption, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-select label="Toppings" [multiple]="true" [clearable]="true" [maxTagCount]="2" [(ngModel)]="value">
        @for (t of toppings; track t) {
          <z-select-option [value]="t.toLowerCase()">{{ t }}</z-select-option>
        }
      </z-select>
      <z-select label="Responsive summary" [multiple]="true" size="sm" variant="filled" [(ngModel)]="value">
        @for (t of toppings; track t) {
          <z-select-option [value]="t.toLowerCase()">{{ t }}</z-select-option>
        }
      </z-select>
      <span>{{ value.length ? value.join(', ') : 'Nothing selected' }}</span>
    </z-stack>
  `,
})
export class SelectMultiple {
  readonly toppings = TOPPINGS;
  value: string[] = ['cheese', 'olive'];
}

```


================================================================================
# COMPONENT: SEPARATOR
================================================================================

## Documentation

# separator — Angular

Processed requirements of [`<z-separator>`](../../../../../requirements/04-components/base/separator.md) for Angular
(`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component } from '@angular/core';
import { ZSeparator } from '@zelviora/angular';

@Component({
  selector: 'app-toolbar',
  imports: [ZSeparator],
  template: `
    <z-separator />                                                
    <z-separator>OR</z-separator>                                  
    <z-separator orientation="vertical" [semantic]="true" />       
  `,
})
export class Toolbar {}
```

## Binding

No model event.

## Events

None.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `separator-basic.ts` | D-1 Default |
| `label` | `separator-label.ts` | D-3 Variants, D-11 RTL label start/end, D-19 label |
| `vertical` | `separator-vertical.ts` | D-17 Composition (toolbar) |

## Differences

- `semantic` is a boolean: bind it (`[semantic]="true"`).
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZSeparator } from '@zelviora/angular';

@Component({
  selector: 'demo-separator-basic',
  imports: [ZSeparator],
  template: `
    <div>
      <p>Account settings</p>
      <z-separator />
      <p>Notification settings</p>
    </div>
  `,
})
export class SeparatorBasic {}

```

### Case: label

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZSeparator, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-separator-label',
  imports: [ZSeparator, ZStack],
  template: `
    <z-stack gap="sm">
      <z-separator>OR</z-separator>
      <z-separator labelPlacement="start" variant="dashed">Details</z-separator>
      <z-separator labelPlacement="end">More</z-separator>
    </z-stack>
  `,
})
export class SeparatorLabel {}

```

### Case: vertical

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZSeparator, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-separator-vertical',
  imports: [ZSeparator, ZStack],
  template: `
    <z-stack orientation="horizontal" align-items="center" gap="none">
      <span>Edit</span>
      <z-separator orientation="vertical" [semantic]="true" />
      <span>Share</span>
      <z-separator orientation="vertical" [semantic]="true" />
      <span>Delete</span>
    </z-stack>
  `,
})
export class SeparatorVertical {}

```


================================================================================
# COMPONENT: SIDEBAR
================================================================================

## Documentation

# sidebar — Angular

Processed requirements of `z-sidebar`, `z-sidebar-group` and `z-sidebar-item` ([spec](../../../../../requirements/04-components/navigation/sidebar.md)) for Angular
(`@zelviora/angular`).

## Binding and events

| Input | Output | Detail |
|---|---|---|
| `[collapsed]` | `(zCollapseChange)` | `{ collapsed, reason }` / `{ collapsed }` |
| `[expanded]` | `(zExpandedChange)` | `{ value, expanded }` |

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `sidebar-default.ts` | D-1 Default, D-6 States, D-7 Disabled |
| `collapsible` | `sidebar-collapsible.ts` | D-9 Controlled, D-17 Composition (flyout, hotkey), D-15 Keyboard-only |
| `spa-routing` | `sidebar-spa-routing.ts` | D-24 SPA routing (app link in an item) |

## Demo classes

The demos use this rule of `src/styles/demo.css` (copy it into the app stylesheet):

```css
/* Frame of a sidebar demo: a fixed height app area (the app shell gives the real size). */
.demo-sidebar-frame {
  block-size: calc(var(--z-space-24) * 4.5);
  overflow: hidden;
  border: var(--z-border-width-1) solid var(--z-color-border);
  border-radius: var(--z-radius-md);
}
```

## Differences

- A group emits its own `zGroupCollapseChange` (not `zCollapseChange`), so a handler on the sidebar never sees a group collapse as its own.
- Bind booleans with `[prop]="true"`; plain attributes are strings.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: collapsible

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZBadge, ZIcon, ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-sidebar-collapsible',
  imports: [ZBadge, ZIcon, ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack],
  template: `
    <z-stack orientation="horizontal" class="demo-sidebar-frame">
      <z-sidebar label="Main navigation" [collapsible]="true" hotkey="Mod+B" [collapsed]="collapsed()" (zCollapseChange)="onCollapse($event)">
        <z-sidebar-group label="Workspace">
          <z-sidebar-item href="#sidebar-dashboard" [current]="true">
            <z-icon slot="icon" name="home"></z-icon>
            Dashboard
          </z-sidebar-item>
          <z-sidebar-item href="#sidebar-orders">
            <z-icon slot="icon" name="receipt_long"></z-icon>
            Orders
            <z-badge slot="end">12</z-badge>
          </z-sidebar-item>
          <z-sidebar-item id="sidebar-reports">
            <z-icon slot="icon" name="bar_chart"></z-icon>
            Reports
            <z-sidebar-item slot="sub" href="#sidebar-sales">Sales</z-sidebar-item>
            <z-sidebar-item slot="sub" href="#sidebar-stock">Stock</z-sidebar-item>
            <z-sidebar-item slot="sub" href="#sidebar-customers">Customers</z-sidebar-item>
          </z-sidebar-item>
        </z-sidebar-group>
        <z-sidebar-group label="Settings" [collapsible]="true">
          <z-sidebar-item href="#sidebar-team">
            <z-icon slot="icon" name="person"></z-icon>
            Team
          </z-sidebar-item>
          <z-sidebar-item href="#sidebar-billing" [disabled]="true">
            <z-icon slot="icon" name="payments"></z-icon>
            Billing
          </z-sidebar-item>
        </z-sidebar-group>
      </z-sidebar>
      <p class="demo-grow">Collapsed: {{ collapsed() }}. Press Ctrl+B (⌘B on macOS) to toggle.</p>
    </z-stack>
  `,
})
export class SidebarCollapsible {
  readonly collapsed = signal(false);

  onCollapse(e: CustomEvent<{ collapsed: boolean }>) {
    // Group events bubble through the sidebar: only the sidebar's own event changes `collapsed`.
    if (e.target === e.currentTarget) this.collapsed.set(e.detail.collapsed);
  }
}

```

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZIcon, ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-sidebar-default',
  imports: [ZBadge, ZIcon, ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack],
  template: `
    <z-stack orientation="horizontal" class="demo-sidebar-frame">
      <z-sidebar label="Main navigation">
        <z-sidebar-group label="Workspace">
          <z-sidebar-item href="#sidebar-dashboard" [current]="true">
            <z-icon slot="icon" name="home"></z-icon>
            Dashboard
          </z-sidebar-item>
          <z-sidebar-item href="#sidebar-orders">
            <z-icon slot="icon" name="receipt_long"></z-icon>
            Orders
            <z-badge slot="end">12</z-badge>
          </z-sidebar-item>
          <z-sidebar-item id="sidebar-reports">
            <z-icon slot="icon" name="bar_chart"></z-icon>
            Reports
            <z-sidebar-item slot="sub" href="#sidebar-sales">Sales</z-sidebar-item>
            <z-sidebar-item slot="sub" href="#sidebar-stock">Stock</z-sidebar-item>
            <z-sidebar-item slot="sub" href="#sidebar-customers">Customers</z-sidebar-item>
          </z-sidebar-item>
        </z-sidebar-group>
        <z-sidebar-group label="Settings" [collapsible]="true">
          <z-sidebar-item href="#sidebar-team">
            <z-icon slot="icon" name="person"></z-icon>
            Team
          </z-sidebar-item>
          <z-sidebar-item href="#sidebar-billing" [disabled]="true">
            <z-icon slot="icon" name="payments"></z-icon>
            Billing
          </z-sidebar-item>
        </z-sidebar-group>
      </z-sidebar>
      <p class="demo-grow">Page content</p>
    </z-stack>
  `,
})
export class SidebarDefault {}

```

### Case: spa-routing

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack } from '@zelviora/angular';

// SPA routing (ADR-026): one (zNavigate) listener routes with the app router; Ctrl/⌘-click still opens a new tab.
@Component({
  selector: 'demo-sidebar-spa-routing',
  imports: [ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack],
  template: `
    <z-stack orientation="horizontal" class="demo-sidebar-frame">
      <z-sidebar label="Main navigation" (zNavigate)="navigate($event)">
        <z-sidebar-group label="Workspace">
          <z-sidebar-item href="#/dashboard" [current]="route === '#/dashboard'">Dashboard</z-sidebar-item>
          <z-sidebar-item href="#/orders" [current]="route === '#/orders'">Orders</z-sidebar-item>
          <z-sidebar-item [current]="route === '#/team'"><a href="#/team" (click)="appLink($event)">Team</a></z-sidebar-item>
        </z-sidebar-group>
      </z-sidebar>
      <p aria-live="polite">Current route: <code>{{ route }}</code></p>
    </z-stack>
  `,
})
export class SidebarSpaRouting {
  route = '#/dashboard';

  /** One zNavigate listener calls the app router (stand-in for `Router.navigateByUrl`). */
  navigate(e: Event): void {
    const ev = e as CustomEvent<{ href: string }>;
    ev.preventDefault();
    this.route = ev.detail.href; // this.router.navigateByUrl(...)
  }

  /** Stand-in for `<a routerLink>`: an `<a href>` that routes on a plain click. */
  appLink(e: MouseEvent): void {
    if (e.ctrlKey || e.metaKey || e.shiftKey || e.button !== 0) return;
    e.preventDefault();
    this.route = (e.currentTarget as HTMLAnchorElement).getAttribute('href')!;
  }
}

```


================================================================================
# COMPONENT: SIGNATURE
================================================================================

## Documentation

# Signature

Electronic signature pad (`<z-signature>`) for Angular 18–21 supporting `ReactiveFormsModule`, `[(ngModel)]` (`TextValueAccessor` / `FORM_DIRECTIVES`), High-DPI canvas smoothing, undo/clear actions, signing guide line, and SVG/PNG/JPEG Data URL export.

## Basic usage

```ts
import { Component } from '@angular/core';
import { FormControl, ReactiveFormsModule, Validators } from '@angular/forms';
import { FORM_DIRECTIVES, ZField, ZSignature, validityMessage } from '@zelviora/angular';

@Component({
  selector: 'app-approval-pad',
  imports: [ReactiveFormsModule, ...FORM_DIRECTIVES, ZField, ZSignature],
  template: `
    <z-field label="Authorized signature" [required]="true" [error]="sig.touched ? validityMessage(sig.errors) : undefined">
      <z-signature [formControl]="sig" [showGuide]="true" [required]="true"></z-signature>
    </z-field>
  `,
})
export class ApprovalPadComponent {
  readonly validityMessage = validityMessage;
  readonly sig = new FormControl('', { nonNullable: true, validators: [Validators.required] });
}
```


## Examples & Implementation

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { TextValueAccessor, ZSignature, ZStack } from '@zelviora/angular';

/** Draw directly on the High-DPI canvas with guide line, undo, and clear controls. */
@Component({
  selector: 'demo-signature-default',
  imports: [FormsModule, TextValueAccessor, ZSignature, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-signature
        label="Authorized signature"
        hint="Sign using mouse, trackpad, or stylus"
        [(ngModel)]="value"
        [showGuide]="true"
      ></z-signature>
      <span>Status: {{ value ? 'Signed (' + value.length + ' chars)' : 'Empty' }}</span>
    </z-stack>
  `,
})
export class SignatureDefault {
  value = '';
}

```

### Case: form

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZField, ZSignature, ZStack } from '@zelviora/angular';

/** Required signature inside a native form with FormData submission and reset. */
@Component({
  selector: 'demo-signature-form',
  imports: [ZButton, ZField, ZSignature, ZStack],
  template: `
    <form class="demo-narrow" (submit)="submit($event)">
      <z-stack>
        <z-field label="Approval signature" hint="Required before submitting contract" [required]="true">
          <z-signature name="approvalSignature" [showGuide]="true" [required]="true"></z-signature>
        </z-field>
        <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
          <z-button type="submit">Submit</z-button>
          <z-button type="reset" variant="outline" tone="neutral">Reset</z-button>
        </z-stack>
        @if (sent()) {
          <output>{{ sent() }}</output>
        }
      </z-stack>
    </form>
  `,
})
export class SignatureForm {
  readonly sent = signal('');

  submit(e: Event) {
    e.preventDefault();
    const data = new FormData(e.currentTarget as HTMLFormElement);
    const sig = String(data.get('approvalSignature') ?? '');
    this.sent.set(sig ? `Submitted (${sig.slice(0, 32)}...)` : 'No signature submitted');
  }
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZSignature, ZStack } from '@zelviora/angular';

/** Disabled, readonly, contextual status, and invalid signature pads. */
@Component({
  selector: 'demo-signature-states',
  imports: [ZSignature, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-signature label="Disabled" [disabled]="true" [showGuide]="true"></z-signature>
      <z-signature label="Readonly" [readonly]="true" [showGuide]="true"></z-signature>
      <z-signature label="Warning status" status="warning" hint="Signature differs from file record"></z-signature>
      <z-signature label="Invalid" [invalid]="true" hint="Please provide your signature"></z-signature>
    </z-stack>
  `,
})
export class SignatureStates {}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZSignature, ZStack } from '@zelviora/angular';

/** Outline, filled, and borderless visual variants across small, medium, and large sizes. */
@Component({
  selector: 'demo-signature-variants',
  imports: [ZSignature, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-signature label="Outline (small)" variant="outline" size="sm" [showGuide]="true"></z-signature>
      <z-signature label="Filled (medium)" variant="filled" size="md" [showGuide]="true"></z-signature>
      <z-signature label="Borderless (large)" variant="borderless" size="lg" [showGuide]="true"></z-signature>
    </z-stack>
  `,
})
export class SignatureVariants {}

```


================================================================================
# COMPONENT: SKELETON
================================================================================

## Documentation

# skeleton — Angular

Processed requirements of [`<z-skeleton>`](../../../../../requirements/04-components/base/skeleton.md) for Angular (`@zelviora/angular`).

## Usage

```ts
import { Component, signal } from '@angular/core';
import { ZSkeleton } from '@zelviora/angular';

@Component({
  selector: 'app-report',
  imports: [ZSkeleton],
  template: `
    <section [attr.aria-busy]="loading()">
      @if (loading()) { <z-skeleton shape="text" [lines]="3"></z-skeleton> } @else { <p>Report</p> }
    </section>
  `,
})
export class Report { readonly loading = signal(true); }
```

The skeleton is hidden from screen readers; the loading container sets `aria-busy`. The shimmer stops with
`disableAnimation` and always under reduced motion.

## Binding

No model event.

## Events

None.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `skeleton-basic.ts` | D-1 Default (rect 200×20) |
| `shapes` | `skeleton-shapes.ts` | D-3 Variants, D-17 Composition (card placeholder) |
| `loading` | `skeleton-loading.ts` | D-9 skeleton to real content; **Reload** shows the skeleton again |

## Differences

- Boolean and number props are bound with `[prop]="…"` (`[required]="true"`, `[maxLength]="20"`), so the value reaches the element with its type.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZSkeleton } from '@zelviora/angular';

@Component({
  selector: 'demo-skeleton-basic',
  imports: [ZSkeleton],
  template: `<z-skeleton width="200px" height="20px"></z-skeleton>`,
})
export class SkeletonBasic {}

```

### Case: loading

#### Angular
```typescript
import { Component, DestroyRef, inject, signal } from '@angular/core';
import { ZButton, ZSkeleton, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-skeleton-loading',
  imports: [ZButton, ZSkeleton, ZStack],
  template: `
    <z-stack gap="sm" align-items="start">
      <section [attr.aria-busy]="!loaded()" class="demo-narrow">
        @if (loaded()) {
          <p>Your report for September is ready: revenue grew 12% compared with August.</p>
        } @else {
          <z-skeleton shape="text" [lines]="2"></z-skeleton>
        }
      </section>
      <z-button variant="outline" size="sm" [disabled]="!loaded()" (click)="load()">Reload</z-button>
    </z-stack>
  `,
})
export class SkeletonLoading {
  readonly loaded = signal(false);
  private timer?: ReturnType<typeof setTimeout>;

  constructor() {
    this.load();
    inject(DestroyRef).onDestroy(() => clearTimeout(this.timer));
  }

  load() {
    this.loaded.set(false);
    clearTimeout(this.timer);
    this.timer = setTimeout(() => this.loaded.set(true), 2000);
  }
}

```

### Case: shapes

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZSkeleton, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-skeleton-shapes',
  imports: [ZSkeleton, ZStack],
  template: `
    <z-stack orientation="horizontal" gap="md" align-items="start" aria-busy="true" class="demo-narrow">
      <z-skeleton shape="circle" width="40px"></z-skeleton>
      <!-- demo-grow: the text column takes the rest of the row. -->
      <z-stack gap="sm" class="demo-grow">
        <z-skeleton shape="text" width="50%"></z-skeleton>
        <z-skeleton shape="text" [lines]="3"></z-skeleton>
      </z-stack>
    </z-stack>
  `,
})
export class SkeletonShapes {}

```


================================================================================
# COMPONENT: SLIDER
================================================================================

## Documentation

# slider — Angular

Processed requirements of [`<z-slider>`](../../../../../requirements/04-components/form/slider.md) for Angular (`@zelviora/angular`).

## Usage

```ts
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { NumericValueAccessor, ZSlider } from '@zelviora/angular';

@Component({
  selector: 'app-volume',
  imports: [FormsModule, NumericValueAccessor, ZSlider],
  template: `<z-slider label="Volume" name="volume" [(ngModel)]="volume"></z-slider>`,
})
export class Volume { volume = 40; }
```

Always has a value (default `min`), normalized to `min + k·step` and clamped. Keys follow the on-screen direction:
in RTL, ArrowRight decreases. `formatValue(value, locale)` formats the bubble and `aria-valuetext`.

## Binding

| Value accessor / prop | Model event |
|---|---|
| `NumericValueAccessor`, `[(ngModel)]` / `formControl` (`number`) | `zInput` |

Form reset restores the default value without events; reset your state yourself.

## Events

`zInput` (every step while dragging, every key), `zChange` (pointer released after a change, every key).

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `slider-default.ts` | D-1 Default, D-5 Sizes, D-7 Disabled |
| `marks` | `slider-marks.ts` | D-21 Marks |
| `vertical` | `slider-vertical.ts` | D-22 Vertical |
| `controlled` | `slider-controlled.ts` | D-9 Controlled (with number-input) |
| `form` | `slider-form.ts` | D-10 In form (formatValue) |
| `i18n` | `slider-i18n.ts` | D-19 i18n (formatValue VND) |

Not yet covered: D-6 States, D-11 RTL, D-18 Customization (tokens, `::part(range)`).


## Examples & Implementation

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { NumericValueAccessor, ZNumberInput, ZSlider, ZStack } from '@zelviora/angular';

/** One signal shared by a slider and a number-input (both through ngModel and NumericValueAccessor). */
@Component({
  selector: 'demo-slider-controlled',
  imports: [FormsModule, NumericValueAccessor, ZNumberInput, ZSlider, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-slider label="Budget share" [ngModel]="value()" (ngModelChange)="value.set($event)"></z-slider>
      <z-number-input label="Budget share (exact)" [min]="0" [max]="100" [ngModel]="value()" (ngModelChange)="value.set($event ?? 0)"></z-number-input>
    </z-stack>
  `,
})
export class SliderControlled {
  readonly value = signal(25);
}

```

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZSlider, ZStack } from '@zelviora/angular';

/** A 0–100 slider with a hint; the value bubble shows while dragging or focused. */
@Component({
  selector: 'demo-slider-default',
  imports: [ZSlider, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-slider label="Volume" name="volume" [value]="40" hint="Speaker volume"></z-slider>
      <z-slider label="Brightness" [value]="70" showValue="always" size="lg"></z-slider>
      <z-slider label="Locked" [value]="20" [disabled]="true"></z-slider>
    </z-stack>
  `,
})
export class SliderDefault {}

```

### Case: form

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZSlider, ZStack } from '@zelviora/angular';

/** The form gets the canonical number; formatValue only changes the bubble and aria-valuetext. */
@Component({
  selector: 'demo-slider-form',
  imports: [ZButton, ZSlider, ZStack],
  template: `
    <form class="demo-narrow" (submit)="submit($event)">
      <z-stack>
        <z-slider label="Budget" name="budget" [min]="0" [max]="1000" [step]="50" [value]="300" [formatValue]="usd" showValue="always"></z-slider>
        <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
          <z-button type="submit">Submit</z-button>
          <z-button type="reset" variant="outline" tone="neutral">Reset</z-button>
        </z-stack>
        @if (sent()) {
          <output>{{ sent() }}</output>
        }
      </z-stack>
    </form>
  `,
})
export class SliderForm {
  readonly usd = (v: number, locale: string) => new Intl.NumberFormat(locale, { style: 'currency', currency: 'USD', maximumFractionDigits: 0 }).format(v);
  readonly sent = signal('');

  submit(e: Event) {
    e.preventDefault();
    this.sent.set(JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]));
  }
}

```

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZSlider } from '@zelviora/angular';

/** `lang="vi"`: formatValue formats the bubble and aria-valuetext as VND. */
@Component({
  selector: 'demo-slider-i18n',
  imports: [ZSlider],
  template: `
    <div class="demo-narrow" lang="vi">
      <z-slider label="Ngân sách" [min]="0" [max]="1000000" [step]="50000" [value]="300000" [formatValue]="vnd" showValue="always"></z-slider>
    </div>
  `,
})
export class SliderI18n {
  readonly vnd = (v: number, locale: string) => new Intl.NumberFormat(locale, { style: 'currency', currency: 'VND' }).format(v);
}

```

### Case: marks

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZSlider, ZStack } from '@zelviora/angular';

/** Marks with labels and snapping to them; `marks` true draws one tick per step. */
@Component({
  selector: 'demo-slider-marks',
  imports: [ZSlider, ZStack],
  template: `
    <z-stack class="demo-narrow">
      <z-slider label="Zoom" [marks]="marks" [snapToMarks]="true" [value]="50"></z-slider>
      <z-slider label="Rating" [min]="0" [max]="10" [marks]="true" [value]="6"></z-slider>
    </z-stack>
  `,
})
export class SliderMarks {
  readonly marks = [0, 25, 50, 75, 100].map((value) => ({ value, label: `${value}%` }));
}

```

### Case: vertical

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZSlider, ZStack } from '@zelviora/angular';

/** Vertical sliders: ArrowUp/ArrowRight increase, the bottom is the minimum. */
@Component({
  selector: 'demo-slider-vertical',
  imports: [ZSlider, ZStack],
  template: `
    <z-stack orientation="horizontal" gap="lg">
      <z-slider label="Bass" orientation="vertical" [value]="30"></z-slider>
      <z-slider label="Treble" orientation="vertical" [value]="60"></z-slider>
    </z-stack>
  `,
})
export class SliderVertical {}

```


================================================================================
# COMPONENT: SPINNER
================================================================================

## Documentation

# spinner — Angular

Processed requirements of [`<z-spinner>`](../../../../../requirements/04-components/base/spinner.md) for Angular (`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component, signal } from '@angular/core';
import { ZSpinner } from '@zelviora/angular';

@Component({
  selector: 'app-orders',
  imports: [ZSpinner],
  template: `@if (loading()) { <z-spinner label="Loading orders" [delay]="300"></z-spinner> }`,
})
export class Orders { readonly loading = signal(true); }
```

Render the spinner only while loading (`@if`): it announces its label once when it appears. Use `[decorative]="true"`
when the parent already announces loading.

## Binding

No value accessor, no value.

## Events

None.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `spinner-default.ts` | D-1 Default |
| `sizes` | `spinner-sizes.ts` | D-5 Sizes (xs..xl) |
| `tones` | `spinner-tones.ts` | D-4 Tones (current + 6 tones; `current` inside text colored by class `demo-text-destructive`) |
| `label` | `spinner-label.ts` | D-3 Variants (`showLabel`), D-14 long label |
| `delay` | `spinner-delay.ts` | D-9 Controlled (on/off + delay 300 ms) |
| `decorative` | `spinner-decorative.ts` | D-17 Composition (in a card that announces loading itself) |

Not covered here: D-2 playground, D-6 reduced motion / forced colors, D-11 RTL, D-12 dark (the docs theme switch),
D-13 brand showcase, D-18 customization, D-19 i18n. D-7, D-8, D-10, D-15, D-16 do not apply.

## Differences

- Boolean and number props are bound with `[prop]="…"` (`[loading]="true"`), so the value reaches the element with its type.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: decorative

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCard, ZSpinner, ZStack } from '@zelviora/angular';

/** The card announces loading itself (`aria-busy` and visible text), so the spinner is hidden from assistive technology. */
@Component({
  selector: 'demo-spinner-decorative',
  imports: [ZCard, ZSpinner, ZStack],
  template: `
    <z-card heading="Orders" aria-busy="true" class="demo-narrow">
      <z-stack orientation="horizontal" align-items="center" gap="sm">
        <z-spinner [decorative]="true" size="sm"></z-spinner>
        <span>Loading orders…</span>
      </z-stack>
    </z-card>
  `,
})
export class SpinnerDecorative {}

```

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZSpinner } from '@zelviora/angular';

@Component({
  selector: 'demo-spinner-default',
  imports: [ZSpinner],
  template: `<z-spinner></z-spinner>`,
})
export class SpinnerDefault {}

```

### Case: delay

#### Angular
```typescript
import { Component, signal, type WritableSignal } from '@angular/core';
import { ZButton, ZSpinner, ZStack } from '@zelviora/angular';

/** Loading driven from outside; with `delay` the spinner only appears when loading lasts longer than 300 ms. */
@Component({
  selector: 'demo-spinner-delay',
  imports: [ZButton, ZSpinner, ZStack],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" align-items="center" gap="md" [wrap]="true">
        <z-button variant="outline" tone="neutral" (click)="run(fast, 200)">Fast load (200 ms)</z-button>
        @if (fast()) {
          <z-spinner [delay]="300" [showLabel]="true"></z-spinner>
        }
      </z-stack>
      <z-stack orientation="horizontal" align-items="center" gap="md" [wrap]="true">
        <z-button variant="outline" tone="neutral" (click)="run(slow, 2000)">Slow load (2 s)</z-button>
        @if (slow()) {
          <z-spinner [delay]="300" [showLabel]="true"></z-spinner>
        }
      </z-stack>
    </z-stack>
  `,
})
export class SpinnerDelay {
  readonly fast = signal(false);
  readonly slow = signal(false);

  run(flag: WritableSignal<boolean>, ms: number) {
    flag.set(true);
    setTimeout(() => flag.set(false), ms);
  }
}

```

### Case: label

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZSpinner, ZStack } from '@zelviora/angular';

/** The label is the accessible name; `showLabel` also shows it next to the spinner. */
@Component({
  selector: 'demo-spinner-label',
  imports: [ZSpinner, ZStack],
  template: `
    <z-stack gap="md">
      <z-spinner [showLabel]="true"></z-spinner>
      <z-spinner [showLabel]="true" tone="primary" label="Loading the order list"></z-spinner>
      <z-spinner
        [showLabel]="true"
        size="sm"
        label="Synchronizing the quarterly revenue report of every branch, this can take a few minutes"
      ></z-spinner>
    </z-stack>
  `,
})
export class SpinnerLabel {}

```

### Case: sizes

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZSpinner, ZStack } from '@zelviora/angular';

const SIZES = ['xs', 'sm', 'md', 'lg', 'xl'] as const;

@Component({
  selector: 'demo-spinner-sizes',
  imports: [ZSpinner, ZStack],
  template: `
    <z-stack orientation="horizontal" align-items="center" gap="lg" [wrap]="true">
      @for (size of sizes; track size) {
        <z-spinner [size]="size" [label]="'Loading (' + size + ')'"></z-spinner>
      }
    </z-stack>
  `,
})
export class SpinnerSizes {
  readonly sizes = SIZES;
}

```

### Case: tones

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZSpinner, ZStack } from '@zelviora/angular';

const TONES = ['neutral', 'primary', 'success', 'warning', 'destructive', 'info'] as const;

/** `current` (default) takes the surrounding text color; the other tones use their semantic color. */
@Component({
  selector: 'demo-spinner-tones',
  imports: [ZSpinner, ZStack],
  template: `
    <z-stack orientation="horizontal" align-items="center" gap="lg" [wrap]="true">
      <span class="demo-text-destructive">
        <z-spinner size="lg" label="Loading (current color)"></z-spinner>
      </span>
      @for (tone of tones; track tone) {
        <z-spinner size="lg" [tone]="tone" [label]="'Loading (' + tone + ')'"></z-spinner>
      }
    </z-stack>
  `,
})
export class SpinnerTones {
  readonly tones = TONES;
}

```


================================================================================
# COMPONENT: SPLITTER
================================================================================

## Documentation

# splitter — Angular

Processed requirements of `z-splitter`, `z-splitter-panel` and `z-splitter-handle`
([spec](../../../../../requirements/04-components/layout/splitter.md)) for Angular (`@zelviora/angular`, standalone components).

## Usage

```html
<z-splitter [value]="sizes()" (zInput)="sizes.set($event.detail.value)">
  <z-splitter-panel id="list" [defaultSize]="30" minSize="240px">…</z-splitter-panel>
  <z-splitter-handle label="Resize the list"></z-splitter-handle>
  <z-splitter-panel>…</z-splitter-panel>
</z-splitter>
```

## Binding and events

Not a form control and no value accessor (spec §12, `model-events.ts`): bind `[value]` + `(zInput)`.

| Input | Output | Detail |
|---|---|---|
| `[value]` (`number[]`, percent, sum 100) | `(zInput)` while dragging / each key step | `{ value }` |
| | `(zChange)` on release, after a key step, after a double-click reset | `{ value }` |
| | `(zCollapseChange)` | `{ panelIndex, collapsed }` |

The pane headings, texts, handle labels and sizes come from `data.ts`, generated from
`documents/shared/splitter/data.ts` by `pnpm docs:data` (identical in React, Vue and Angular).

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `splitter-default.ts` | D-1 Default, D-15 Keyboard-only (arrows, Home/End, double-click reset) |
| `vertical` | `splitter-vertical.ts` | D-3 Variants (vertical, `withGrip`) |
| `collapsible` | `splitter-collapsible.ts` | D-6 States (collapsed), px constraints (K-7) |
| `controlled` | `splitter-controlled.ts` | D-9 Controlled (`value` from outside, event log) |
| `nested` | `splitter-nested.ts` | D-3 Variants (nested), D-17 Composition (IDE with 3 panels), D-21 Persist (`persistKey`) |

Not yet covered: D-2 playground, D-7 disabled, D-11 RTL, D-12 dark / D-13 brand (theme switch of the docs site),
D-14 long content, D-16 density, D-18 customization, D-19 i18n. Not applicable: D-4, D-5, D-8, D-10, D-20.

## Demo classes

The demos use these rules of `src/styles/demo.css` (copy them into the app stylesheet; the app gives the group its size):

```css
/* Frame of a splitter demo: the panels share a fixed height area (the app gives the group its size). */
.demo-splitter-frame {
  block-size: calc(var(--z-space-24) * 3);
  border: var(--z-border-width-1) solid var(--z-color-border);
  border-radius: var(--z-radius-md);
}

/* A splitter nested in a panel fills the panel. */
.demo-fill {
  block-size: 100%;
}

/* Inner spacing of the content of a splitter panel. */
.demo-pane {
  box-sizing: border-box;
  padding: var(--z-space-3);
}
```

## Differences

- No `ngModel`: the value is an array (spec §14 ⚠️), so Angular binds `[value]` + `(zInput)` instead of a value accessor.
- `defaultSize`, `minSize`, `maxSize` and `collapsedSize` take a number (percent, `[minSize]="20"`) or a string:
  `minSize="240px"` is pixels, `minSize="20"` or `"20%"` is percent.
- `zCollapseChange` of a nested splitter bubbles through the outer one: check `event.target` in a handler on the outer group.
- Bind booleans with `[prop]="true"`; plain attributes are strings.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: collapsible

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZCard, ZSplitter, ZSplitterHandle, ZSplitterPanel, ZStack, ZText } from '@zelviora/angular';
import { collapsedLog, collapsibleSplit } from '../data';

@Component({
  selector: 'demo-splitter-collapsible',
  imports: [ZCard, ZSplitter, ZSplitterHandle, ZSplitterPanel, ZStack, ZText],
  template: `
    <z-stack gap="sm">
      <z-splitter class="demo-splitter-frame" (zCollapseChange)="collapsed.set($event.detail.collapsed)">
        <z-splitter-panel [id]="nav.id!" [defaultSize]="nav.defaultSize" [minSize]="nav.minSize" [maxSize]="nav.maxSize" [collapsible]="nav.collapsible ?? false">
          <z-card variant="ghost" [heading]="nav.heading">
            <z-text [variant]="nav.variant ?? 'body'">{{ nav.text }}</z-text>
          </z-card>
        </z-splitter-panel>
        <z-splitter-handle [label]="split.handleLabel" [withGrip]="split.withGrip ?? false"></z-splitter-handle>
        <z-splitter-panel>
          <z-card variant="ghost" [heading]="files.heading">
            <z-text [variant]="files.variant ?? 'body'">{{ files.text }}</z-text>
          </z-card>
        </z-splitter-panel>
      </z-splitter>
      <z-text variant="muted" size="sm">{{ collapsedLog(collapsed()) }}</z-text>
    </z-stack>
  `,
})
export class SplitterCollapsible {
  readonly split = collapsibleSplit;
  readonly nav = collapsibleSplit.panes[0];
  readonly files = collapsibleSplit.panes[1];
  readonly collapsedLog = collapsedLog;
  readonly collapsed = signal(false);
}

```

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZCard, ZSplitter, ZSplitterHandle, ZSplitterPanel, ZStack, ZText } from '@zelviora/angular';
import { controlledInitial, controlledLog, controlledPresets, controlledSplit } from '../data';

@Component({
  selector: 'demo-splitter-controlled',
  imports: [ZButton, ZCard, ZSplitter, ZSplitterHandle, ZSplitterPanel, ZStack, ZText],
  template: `
    <z-stack gap="sm">
      <z-stack orientation="horizontal" gap="sm" [wrap]="true">
        @for (p of presets; track p.label) {
          <z-button size="sm" variant="outline" tone="neutral" (click)="value.set(p.value)">{{ p.label }}</z-button>
        }
      </z-stack>
      <z-splitter class="demo-splitter-frame" [value]="value()" (zInput)="value.set($event.detail.value)" (zChange)="committed.set($event.detail.value)">
        <z-splitter-panel [minSize]="original.minSize">
          <z-card variant="ghost" [heading]="original.heading"></z-card>
        </z-splitter-panel>
        <z-splitter-handle [label]="split.handleLabel"></z-splitter-handle>
        <z-splitter-panel [minSize]="revised.minSize">
          <z-card variant="ghost" [heading]="revised.heading"></z-card>
        </z-splitter-panel>
      </z-splitter>
      <z-text variant="muted" size="sm">{{ controlledLog(value(), committed()) }}</z-text>
    </z-stack>
  `,
})
export class SplitterControlled {
  readonly split = controlledSplit;
  readonly original = controlledSplit.panes[0];
  readonly revised = controlledSplit.panes[1];
  readonly presets = controlledPresets;
  readonly controlledLog = controlledLog;
  readonly value = signal<number[]>(controlledInitial);
  readonly committed = signal<number[]>(controlledInitial);
}

```

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCard, ZSplitter, ZSplitterHandle, ZSplitterPanel, ZText } from '@zelviora/angular';
import { defaultSplit } from '../data';

@Component({
  selector: 'demo-splitter-default',
  imports: [ZCard, ZSplitter, ZSplitterHandle, ZSplitterPanel, ZText],
  template: `
    <z-splitter class="demo-splitter-frame">
      <z-splitter-panel [id]="list.id!" [defaultSize]="list.defaultSize" [minSize]="list.minSize">
        <z-card variant="ghost" [heading]="list.heading">
          <z-text [variant]="list.variant ?? 'body'">{{ list.text }}</z-text>
        </z-card>
      </z-splitter-panel>
      <z-splitter-handle [label]="split.handleLabel"></z-splitter-handle>
      <z-splitter-panel [minSize]="message.minSize">
        <z-card variant="ghost" [heading]="message.heading">
          <z-text [variant]="message.variant ?? 'body'">{{ message.text }}</z-text>
        </z-card>
      </z-splitter-panel>
    </z-splitter>
  `,
})
export class SplitterDefault {
  readonly split = defaultSplit;
  readonly list = defaultSplit.panes[0];
  readonly message = defaultSplit.panes[1];
}

```

### Case: nested

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCard, ZSplitter, ZSplitterHandle, ZSplitterPanel, ZText } from '@zelviora/angular';
import { nestedInner, nestedOuter, nestedPersistKey } from '../data';

/** IDE layout: a file tree, then an editor above a terminal. The sizes persist in localStorage (`persistKey`, by panel id). */
@Component({
  selector: 'demo-splitter-nested',
  imports: [ZCard, ZSplitter, ZSplitterHandle, ZSplitterPanel, ZText],
  template: `
    <z-splitter class="demo-splitter-frame" [attr.persist-key]="persistKey">
      <z-splitter-panel [id]="files.id!" [defaultSize]="files.defaultSize" [minSize]="files.minSize">
        <z-card variant="ghost" [heading]="files.heading">
          <z-text [variant]="files.variant ?? 'body'">{{ files.text }}</z-text>
        </z-card>
      </z-splitter-panel>
      <z-splitter-handle [label]="outer.handleLabel"></z-splitter-handle>
      <z-splitter-panel [id]="main.id!">
        <z-splitter orientation="vertical" class="demo-fill">
          <z-splitter-panel [defaultSize]="editor.defaultSize">
            <z-card variant="ghost" [heading]="editor.heading">
              <z-text [variant]="editor.variant ?? 'body'">{{ editor.text }}</z-text>
            </z-card>
          </z-splitter-panel>
          <z-splitter-handle [label]="inner.handleLabel" [withGrip]="inner.withGrip ?? false"></z-splitter-handle>
          <z-splitter-panel [collapsible]="terminal.collapsible ?? false">
            <z-card variant="ghost" [heading]="terminal.heading">
              <z-text [variant]="terminal.variant ?? 'body'">{{ terminal.text }}</z-text>
            </z-card>
          </z-splitter-panel>
        </z-splitter>
      </z-splitter-panel>
    </z-splitter>
  `,
})
export class SplitterNested {
  readonly persistKey = nestedPersistKey;
  readonly outer = nestedOuter;
  readonly inner = nestedInner;
  readonly files = nestedOuter.panes[0];
  readonly main = nestedOuter.panes[1];
  readonly editor = nestedInner.panes[0];
  readonly terminal = nestedInner.panes[1];
}

```

### Case: vertical

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCard, ZSplitter, ZSplitterHandle, ZSplitterPanel, ZText } from '@zelviora/angular';
import { verticalSplit } from '../data';

@Component({
  selector: 'demo-splitter-vertical',
  imports: [ZCard, ZSplitter, ZSplitterHandle, ZSplitterPanel, ZText],
  template: `
    <z-splitter orientation="vertical" class="demo-splitter-frame">
      <z-splitter-panel [defaultSize]="editor.defaultSize" [minSize]="editor.minSize">
        <z-card variant="ghost" [heading]="editor.heading">
          <z-text [variant]="editor.variant ?? 'body'">{{ editor.text }}</z-text>
        </z-card>
      </z-splitter-panel>
      <z-splitter-handle [label]="split.handleLabel" [withGrip]="split.withGrip ?? false"></z-splitter-handle>
      <z-splitter-panel [minSize]="terminal.minSize">
        <z-card variant="ghost" [heading]="terminal.heading">
          <z-text [variant]="terminal.variant ?? 'body'">{{ terminal.text }}</z-text>
        </z-card>
      </z-splitter-panel>
    </z-splitter>
  `,
})
export class SplitterVertical {
  readonly split = verticalSplit;
  readonly editor = verticalSplit.panes[0];
  readonly terminal = verticalSplit.panes[1];
}

```


================================================================================
# COMPONENT: STACK
================================================================================

## Documentation

# stack — Angular

Processed requirements of [`<z-stack>`](../../../../../requirements/04-components/layout/stack.md) for Angular
(`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component } from '@angular/core';
import { ZButton, ZStack } from '@zelviora/angular';

@Component({
  selector: 'app-actions',
  imports: [ZButton, ZStack],
  template: `
    <z-stack orientation="horizontal" gap="sm" justify="end">
      <z-button variant="ghost">Cancel</z-button>
      <z-button>Save</z-button>
    </z-stack>
  `,
})
export class Actions {}
```

The host is the flex container itself (no `base` part): children are flex items. There is no `reverse` prop, so the
reading order always matches the visual order.

## Binding

No model event.

## Events

None.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `stack-basic.ts` | D-1 Default |
| `variants` | `stack-variants.ts` | D-3 Variants, D-14 Long content (wrap) |
| `gaps` | `stack-gaps.ts` | D-5 Sizes, D-16 Density |
| `divider` | `stack-divider.ts` | D-12 divider color (token `--z-stack-divider-color`) |
| `composition` | `stack-composition.ts` | D-17 Composition, D-11 RTL (justify end) |

Not yet covered: D-2 playground, D-13 brand showcase, D-18 `--z-stack-gap` customization (needs app CSS).

## Differences

- Boolean props are bound with `[prop]="true"` (`[wrap]="true"`, `[divider]="true"`, `[inline]="true"`).
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCard, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-stack-basic',
  imports: [ZCard, ZStack],
  template: `
    <z-stack>
      <z-card heading="Profile">Name, avatar and bio.</z-card>
      <z-card heading="Security">Password and two-step sign-in.</z-card>
      <z-card heading="Notifications">Email and push preferences.</z-card>
    </z-stack>
  `,
})
export class StackBasic {}

```

### Case: composition

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZCard, ZStack } from '@zelviora/angular';

/** Dialog-style footer: actions pushed to the inline end (the right in LTR, the left in RTL). */

@Component({
  selector: 'demo-stack-composition',
  imports: [ZButton, ZCard, ZStack],
  template: `
    <z-card heading="Delete project?" description="This removes 12 files and cannot be undone.">
      <z-stack slot="footer" orientation="horizontal" justify="end" gap="sm" [wrap]="true">
        <z-button variant="ghost" tone="neutral">Cancel</z-button>
        <z-button tone="destructive">Delete</z-button>
      </z-stack>
    </z-card>
  `,
})
export class StackComposition {}

```

### Case: divider

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZLink, ZStack } from '@zelviora/angular';

@Component({
  selector: 'demo-stack-divider',
  imports: [ZLink, ZStack],
  template: `
    <z-stack gap="lg">
      <z-stack [divider]="true" gap="sm">
        <span>Order placed</span>
        <span>Payment confirmed</span>
        <span>Shipped</span>
      </z-stack>
      <nav aria-label="Legal">
        <z-stack orientation="horizontal" [divider]="true" gap="md">
          <z-link href="#privacy" tone="neutral">Privacy</z-link>
          <z-link href="#terms" tone="neutral">Terms</z-link>
          <z-link href="#cookies" tone="neutral">Cookies</z-link>
        </z-stack>
      </nav>
    </z-stack>
  `,
})
export class StackDivider {}

```

### Case: gaps

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZStack } from '@zelviora/angular';

const GAPS = ['none', 'xs', 'sm', 'md', 'lg'] as const;

/** Gaps come from the --z-gap-* tokens, so they follow the density of the nearest config-provider. */

@Component({
  selector: 'demo-stack-gaps',
  imports: [ZBadge, ZStack],
  template: `
    <z-stack gap="md">
      @for (gap of gaps; track gap) {
        <z-stack orientation="horizontal" [gap]="gap">
          <z-badge variant="solid">gap="{{ gap }}"</z-badge>
          <z-badge variant="solid">B</z-badge>
          <z-badge variant="solid">C</z-badge>
        </z-stack>
      }
    </z-stack>
  `,
})
export class StackGaps {
  readonly gaps = GAPS;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZStack } from '@zelviora/angular';

const TAGS = ['design', 'tokens', 'react', 'vue', 'angular', 'accessibility', 'i18n', 'rtl', 'density', 'themes'];

@Component({
  selector: 'demo-stack-variants',
  imports: [ZBadge, ZButton, ZStack],
  template: `
    <z-stack gap="lg">
      <z-stack orientation="horizontal" align-items="center" gap="sm">
        <z-button>Row</z-button>
        <z-button variant="outline" tone="neutral">align-items="center"</z-button>
      </z-stack>
      <z-stack orientation="horizontal" [wrap]="true" gap="xs">
        @for (tag of tags; track tag) {
          <z-badge>{{ tag }}</z-badge>
        }
      </z-stack>
      <p>
        Inline stack inside text:
        <z-stack [inline]="true" orientation="horizontal" gap="xs">
          <z-badge tone="success">paid</z-badge>
          <z-badge tone="info">shipped</z-badge>
        </z-stack>
      </p>
    </z-stack>
  `,
})
export class StackVariants {
  readonly tags = TAGS;
}

```


================================================================================
# COMPONENT: STATISTIC
================================================================================

## Documentation

# statistic — Angular

Processed requirements of [`<z-statistic>`](../../../../../requirements/04-components/data-display/statistic.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-statistic label="Revenue" [value]="1234567" currency="VND" trend="up" [delta]="0.124"></z-statistic>
```

## Binding

No model event. `format` and `deltaFormat` are `Intl.NumberFormatOptions` objects (set as properties). Search keyword: "Statistic", "KPI", "Countdown" (antd `Statistic`).

## Events

| Output | Detail | Notes |
|---|---|---|
| `(zFinish)` | `{}` | Countdown reached zero (once per target); not cancelable |

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `statistic-basic.ts` | D-1 Default |
| `formats` | `statistic-formats.ts` | D-3 Variants (formats), D-19 i18n |
| `trends` | `statistic-trends.ts` | D-4 Tones |
| `sizes` | `statistic-sizes.ts` | D-5 Sizes |
| `states` | `statistic-states.ts` | D-6 States, D-8 Error, D-20 Empty / loading |
| `dashboard` | `statistic-dashboard.ts` | D-17 Composition, D-9 Controlled |
| `countdown` | `statistic-countdown.ts` | D-21 Countdown |
| `i18n` | `statistic-i18n.ts` | D-19 i18n (`vi` number formats) |


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStatistic } from '@zelviora/angular';

@Component({
  selector: 'demo-statistic-basic',
  imports: [ZStatistic],
  template: `
    <z-statistic label="Active users" [value]="112893"></z-statistic>
  `,
})
export class StatisticBasic {}

```

### Case: countdown

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZStack, ZStatistic } from '@zelviora/angular';

const inSeconds = (s: number) => Date.now() + s * 1000;

@Component({
  selector: 'demo-statistic-countdown',
  imports: [ZButton, ZStack, ZStatistic],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" [wrap]="true" gap="lg">
        <z-statistic label="Flash sale ends in" [countdownTo]="sale"></z-statistic>
        <z-statistic label="Quiz" [countdownTo]="quiz()" (zFinish)="done.set(true)"></z-statistic>
      </z-stack>
      <z-stack orientation="horizontal" align-items="center" gap="sm">
        <z-button variant="outline" tone="neutral" (click)="restart()">Restart quiz</z-button>
        <span>{{ done() ? 'Time is up' : 'Running' }}</span>
      </z-stack>
    </z-stack>
  `,
})
export class StatisticCountdown {
  readonly sale = inSeconds(2 * 3600 + 15 * 60);
  readonly quiz = signal(inSeconds(10));
  readonly done = signal(false);

  restart() {
    this.done.set(false);
    this.quiz.set(inSeconds(10));
  }
}

```

### Case: dashboard

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZCard, ZGrid, ZStack, ZStatistic } from '@zelviora/angular';

@Component({
  selector: 'demo-statistic-dashboard',
  imports: [ZButton, ZCard, ZGrid, ZStack, ZStatistic],
  template: `
    <z-stack gap="md">
      <z-grid columns="1 sm:3" gap="md">
        <z-card>
          <z-statistic label="Visits today" [value]="visits()" trend="up" [delta]="0.052"></z-statistic>
        </z-card>
        <z-card>
          <z-statistic label="Average order" [value]="36.4" currency="EUR" trend="down" [delta]="-0.012"></z-statistic>
        </z-card>
        <z-card>
          <z-statistic label="Downloads" [value]="98">
            <span slot="suffix">/ 120</span>
          </z-statistic>
        </z-card>
      </z-grid>
      <z-stack orientation="horizontal">
        <z-button variant="outline" tone="neutral" (click)="visits.set(visits() + 37)">Refresh</z-button>
      </z-stack>
    </z-stack>
  `,
})
export class StatisticDashboard {
  readonly visits = signal(8240);
}

```

### Case: formats

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGrid, ZStatistic } from '@zelviora/angular';

@Component({
  selector: 'demo-statistic-formats',
  imports: [ZGrid, ZStatistic],
  template: `
    <z-grid columns="1 sm:2 md:4" gap="md">
      <z-statistic label="Revenue" [value]="1234567890" currency="USD"></z-statistic>
      <z-statistic label="Conversion" [value]="0.0342" [format]="{ style: 'percent', maximumFractionDigits: 1 }"></z-statistic>
      <z-statistic label="Page views" [value]="1250000" [format]="{ notation: 'compact' }"></z-statistic>
      <z-statistic label="Storage" [value]="42.5" [format]="{ style: 'unit', unit: 'gigabyte' }"></z-statistic>
    </z-grid>
  `,
})
export class StatisticFormats {}

```

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGrid, ZStatistic } from '@zelviora/angular';

@Component({
  selector: 'demo-statistic-i18n',
  imports: [ZGrid, ZStatistic],
  template: `
    <z-grid columns="1 sm:2" gap="md">
      <z-statistic label="Doanh thu" [value]="1234567890" currency="VND" locale="vi"></z-statistic>
      <z-statistic label="Tỷ lệ chuyển đổi" [value]="0.0342" [format]="{ style: 'percent', maximumFractionDigits: 1 }" locale="vi"></z-statistic>
    </z-grid>
  `,
})
export class StatisticI18n {}

```

### Case: sizes

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack, ZStatistic } from '@zelviora/angular';

@Component({
  selector: 'demo-statistic-sizes',
  imports: [ZStack, ZStatistic],
  template: `
    <z-stack orientation="horizontal" [wrap]="true" gap="lg">
      @for (size of sizes; track size) {
        <z-statistic [size]="size" [label]="'Size ' + size" [value]="2048"></z-statistic>
      }
    </z-stack>
  `,
})
export class StatisticSizes {
  readonly sizes = ['sm', 'md', 'lg'] as const;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack, ZStatistic } from '@zelviora/angular';

@Component({
  selector: 'demo-statistic-states',
  imports: [ZStack, ZStatistic],
  template: `
    <z-stack orientation="horizontal" [wrap]="true" gap="lg">
      <z-statistic label="Loading" [value]="100" [loading]="true"></z-statistic>
      <z-statistic label="Invalid value" [value]="invalid"></z-statistic>
      <z-statistic label="Text value" value="N/A"></z-statistic>
    </z-stack>
  `,
})
export class StatisticStates {
  // Not a finite number: shown as "—".
  readonly invalid = Number.NaN;
}

```

### Case: trends

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGrid, ZStatistic } from '@zelviora/angular';

@Component({
  selector: 'demo-statistic-trends',
  imports: [ZGrid, ZStatistic],
  template: `
    <z-grid columns="1 sm:2 md:4" gap="md">
      <z-statistic label="Revenue" [value]="48200" currency="USD" trend="up" [delta]="0.124"></z-statistic>
      <z-statistic label="Orders" [value]="1320" trend="down" [delta]="-0.031"></z-statistic>
      <z-statistic label="Costs" [value]="9100" currency="USD" trend="up" trendSentiment="negative" [delta]="0.08"></z-statistic>
      <z-statistic label="Refunds" [value]="12" trend="neutral" [delta]="0"></z-statistic>
    </z-grid>
  `,
})
export class StatisticTrends {}

```


================================================================================
# COMPONENT: STEPS
================================================================================

## Documentation

# steps — Angular

Processed requirements of `z-steps` and `z-step` ([spec](../../../../../requirements/04-components/navigation/steps.md)) for Angular
(`@zelviora/angular`).

## Binding and events

| Input | Output | Detail |
|---|---|---|
| `[current]` | `(zChange)` | `{ current, previous }` |

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `steps-default.ts` | D-1 Default, D-19 i18n (hidden status text) |
| `navigable` | `steps-navigable.ts` | D-9 Controlled, D-10 In form (wizard), D-15 Keyboard-only |
| `vertical` | `steps-vertical.ts` | D-21 Vertical, D-8 Error, D-6 States |

## Differences

- Bind booleans with `[prop]="true"`; plain attributes are strings.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStep, ZSteps } from '@zelviora/angular';

@Component({
  selector: 'demo-steps-default',
  imports: [ZStep, ZSteps],
  template: `
    <z-steps [current]="1" label="Checkout progress">
      <z-step>Cart</z-step>
      <z-step description="Address and method">Shipping</z-step>
      <z-step>Payment</z-step>
    </z-steps>
  `,
})
export class StepsDefault {}

```

### Case: navigable

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZStack, ZStep, ZSteps } from '@zelviora/angular';

@Component({
  selector: 'demo-steps-navigable',
  imports: [ZButton, ZStack, ZStep, ZSteps],
  template: `
    <z-stack gap="md">
      <z-steps [current]="current()" [navigable]="true" [linear]="true" label="Sign-up progress" (zChange)="current.set($event.detail.current)">
        @for (t of titles; track t) {
          <z-step>{{ t }}</z-step>
        }
      </z-steps>
      <p>Step {{ current() + 1 }}: {{ titles[current()] }}</p>
      <z-stack orientation="horizontal" gap="sm">
        <z-button variant="outline" tone="neutral" [disabled]="current() === 0" (click)="current.set(current() - 1)">Back</z-button>
        <z-button [disabled]="current() === titles.length - 1" (click)="current.set(current() + 1)">Next</z-button>
      </z-stack>
    </z-stack>
  `,
})
export class StepsNavigable {
  readonly titles = ['Account', 'Profile', 'Preferences', 'Review'];
  readonly current = signal(0);
}

```

### Case: vertical

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStep, ZSteps } from '@zelviora/angular';

@Component({
  selector: 'demo-steps-vertical',
  imports: [ZStep, ZSteps],
  template: `
    <z-steps [current]="2" orientation="vertical" size="sm" label="Deployment">
      <z-step description="Commit 4f2a9c1">Build</z-step>
      <z-step description="212 tests passed">Test</z-step>
      <z-step status="error" description="Health check timed out">Deploy</z-step>
      <z-step>Verify</z-step>
    </z-steps>
  `,
})
export class StepsVertical {}

```


================================================================================
# COMPONENT: SUNBURST-CHART
================================================================================

## Documentation

# Sunburst chart (`<z-sunburst-chart>`)

Multi-ring radial partition chart for exploring nested hierarchical proportions.

## Installation & Import

```tsx
// React (@zelviora/react-chart)
import { ZSunburstChart } from '@zelviora/react-chart';

// Vue 3 (@zelviora/vue-chart)
import { ZSunburstChart } from '@zelviora/vue-chart';

// Angular (@zelviora/angular-chart)
import { ZSunburstChart } from '@zelviora/angular-chart';

// Web Components (@zelviora/chart)
import '@zelviora/chart';
```

## Key Features

- **Tree-shaken ECharts 6 Core**: Automatically registers only the required ECharts chart module and components.
- **Design System Token Synchronization**: Reads `--z-chart-series-1..8`, `--z-chart-grid-color`, and `--z-chart-axis-color`, reacting automatically to Light/Dark mode and theme preset changes.
- **Built-in Accessibility (WCAG AAA)**: Renders a semantic `<figure>` with `<figcaption>`, interactive `aria-pressed` legend toggles, and a synchronized `<table>` for screen readers.
- **Escape Hatch (`option`)**: Deep-merges any raw ECharts `option` object on top of the declarative props.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZSunburstChart } from '@zelviora/angular-chart';
import { storageTree, storageSeries } from '../data';

@Component({
  selector: 'demo-sunburst-chart-basic',
  imports: [ZSunburstChart],
  template: `
    <z-sunburst-chart
      heading="Cloud Storage Partition by Region and Tier (TB)"
      description="Concentric rings break down total storage across geographic regions and storage classes."
      [treeData]="treeData" [series]="series"
    ></z-sunburst-chart>
  `,
})
export class SunburstChartBasic {
  readonly treeData = storageTree;
  readonly series = storageSeries;
}

```

### Case: controlled

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/angular';
import { ZSunburstChart, type ChartPointSelectDetail, type ChartSeriesToggleDetail } from '@zelviora/angular-chart';
import { storageTree, storageSeries } from '../data';

@Component({
  selector: 'demo-sunburst-chart-controlled',
  imports: [ZStack, ZButton, ZBadge, ZText, ZSunburstChart],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <z-button size="sm" variant="outline" (click)="hidden = []">
          Show All Series
        </z-button>
        <z-badge tone="primary" variant="soft">{{ selected }}</z-badge>
        <z-text variant="muted" size="sm">
          Hidden: {{ hidden.length ? hidden.join(', ') : 'none' }}
        </z-text>
      </z-stack>
      <z-sunburst-chart
        heading="Cloud Storage Partition by Region and Tier (TB) (Interactive)"
        description="Concentric rings break down total storage across geographic regions and storage classes."
        [treeData]="treeData" [series]="series"
        [selectable]="true"
        [hiddenSeries]="hidden"
        (zSeriesToggle)="onToggle($event)"
        (zPointSelect)="onSelect($event)"
      ></z-sunburst-chart>
    </z-stack>
  `,
})
export class SunburstChartControlled {
  readonly treeData = storageTree;
  readonly series = storageSeries;
  hidden: string[] = [];
  selected = 'Click any chart element to inspect';

  onToggle(e: CustomEvent<ChartSeriesToggleDetail>) {
    this.hidden = e.detail.hiddenSeries;
  }

  onSelect(e: CustomEvent<ChartPointSelectDetail>) {
    this.selected = `Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`;
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZSunburstChart } from '@zelviora/angular-chart';
import { storageTree, storageSeries } from '../data';

@Component({
  selector: 'demo-sunburst-chart-customization',
  imports: [ZSunburstChart],
  template: `
    <z-sunburst-chart
      class="demo-chart-brand"
      description="Concentric rings break down total storage across geographic regions and storage classes."
      [valueFormat]="{ maximumFractionDigits: 1 }"
      [treeData]="treeData" [series]="series" innerRadius="22%" outerRadius="88%" renderer="canvas"
    >
      <span slot="heading">Cloud Storage Partition by Region and Tier (TB) — Custom Theme Tokens &amp; Canvas</span>
    </z-sunburst-chart>
  `,
})
export class SunburstChartCustomization {
  readonly treeData = storageTree;
  readonly series = storageSeries;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZSunburstChart } from '@zelviora/angular-chart';
import { storageTree, storageSeries } from '../data';

@Component({
  selector: 'demo-sunburst-chart-states',
  imports: [ZStack, ZSunburstChart],
  template: `
    <z-stack gap="lg">
      <z-sunburst-chart
        heading="Loading State (aria-busy)"
        [loading]="true"
        [treeData]="treeData" [series]="series"
      ></z-sunburst-chart>
      <z-sunburst-chart
        heading="Empty State"
        [treeData]="[]"
        [series]="series"
      ></z-sunburst-chart>
      <z-sunburst-chart
        heading="Expanded Accessible Data Table"
        description="Concentric rings break down total storage across geographic regions and storage classes."
        [showDataTable]="true"
        [treeData]="treeData" [series]="series"
      ></z-sunburst-chart>
    </z-stack>
  `,
})
export class SunburstChartStates {
  readonly treeData = storageTree;
  readonly series = storageSeries;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZSunburstChart } from '@zelviora/angular-chart';
import { storageTree, storageSeries } from '../data';

@Component({
  selector: 'demo-sunburst-chart-variants',
  imports: [ZStack, ZSunburstChart],
  template: `
    <z-stack gap="lg">
      <z-sunburst-chart
        heading="Hollow Core Sunburst"
        description="Hollow center ring (28%–86%) vs full-center sunburst without sector labels."
        [treeData]="treeData" [series]="series" innerRadius="28%" outerRadius="86%"
      ></z-sunburst-chart>
      <z-sunburst-chart
        heading="Solid Center Sunburst"
        description="Hollow center ring (28%–86%) vs full-center sunburst without sector labels."
        [treeData]="treeData" [series]="series" innerRadius="0%" outerRadius="78%" [showLabel]="false"
      ></z-sunburst-chart>
    </z-stack>
  `,
})
export class SunburstChartVariants {
  readonly treeData = storageTree;
  readonly series = storageSeries;
}

```


================================================================================
# COMPONENT: SVG
================================================================================

## Documentation

# SVG Angular Demos

Demo cases for `<z-svg>` in Angular.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZSvg, ZStack } from '@zelviora/angular';

const SAMPLE_SVG = `data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2L1 21h22L12 2zm0 3.99L19.53 19H4.47L12 5.99zM11 10v4h2v-4h-2zm0 6v2h2v-2h-2z"/></svg>`;

@Component({
  selector: 'demo-svg-basic',
  imports: [ZSvg, ZStack],
  template: `
    <z-stack orientation="horizontal" gap="lg" align-items="center">
      <z-svg [src]="sampleSvg" image-title="Default size SVG"></z-svg>
      <z-svg [src]="sampleSvg" image-title="Medium size SVG" size="32px" color="var(--z-color-primary)"></z-svg>
      <z-svg [src]="sampleSvg" image-title="Large size SVG" size="48px" color="var(--z-color-success)"></z-svg>
    </z-stack>
  `,
})
export class SvgBasic {
  readonly sampleSvg = SAMPLE_SVG;
}

```

### Case: preview

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZSvg, ZStack, ZText } from '@zelviora/angular';

const DETAILED_SVG = `data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="45" fill="%232563eb"/><path d="M30 50 L45 65 L70 35" stroke="white" stroke-width="8" fill="none" stroke-linecap="round" stroke-linejoin="round"/></svg>`;

@Component({
  selector: 'demo-svg-preview',
  imports: [ZSvg, ZStack, ZText],
  template: `
    <z-stack gap="sm">
      <z-text variant="muted" size="sm">
        Click the SVG graphic below to open full-screen lightbox preview:
      </z-text>
      <z-svg
        [src]="detailedSvg"
        image-title="Verified badge"
        [preview]="true"
        size="64px"
      ></z-svg>
    </z-stack>
  `,
})
export class SvgPreview {
  readonly detailedSvg = DETAILED_SVG;
}

```


================================================================================
# COMPONENT: SWITCH
================================================================================

## Documentation

# switch — Angular

Processed requirements of [`<z-switch>`](../../../../../requirements/04-components/form/switch.md) for Angular (`@zelviora/angular`).

## Usage

```ts
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { BooleanValueAccessor, ZSwitch } from '@zelviora/angular';

@Component({
  selector: 'app-notify',
  imports: [FormsModule, BooleanValueAccessor, ZSwitch],
  template: `<z-switch name="notify" [(ngModel)]="notify">Email notifications</z-switch>`,
})
export class Notify { notify = false; }
```

## Binding

| Value accessor | Model | Event | Detail |
|---|---|---|---|
| `BooleanValueAccessor` | `[(ngModel)]` / `formControl` (`boolean`) | `(zChange)` | `{ checked, value }` |

## Validation (F15)

`BooleanValueAccessor` applies `ValidityValidator`: the native validity of the element reaches Angular forms, so
`required` + `[(ngModel)]` makes the control invalid while off (error `required`, plus `zValidity`). In Reactive Forms
declare `Validators.requiredTrue` (`switch-form.ts`; `Validators.required` counts `false` as a value). Angular adds
`novalidate` to the form, so the app blocks an invalid submit itself (`form.invalid` in the `ngSubmit` handler).

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `switch-default.ts` | D-1 Default, D-9 Controlled |
| `states` | `switch-states.ts` | D-5 Sizes, D-6 States, D-21 Label placement, D-22 Hint |
| `form` | `switch-form.ts` | D-10 In form (Reactive Forms, `requiredTrue`), D-8 Error |

## Differences

- Form reset (`type="reset"`) resets the Reactive Forms model through the form directive; outside forms, reset the model yourself.
- Boolean and number props are bound with `[prop]="…"` (`[required]="true"`, `[maxLength]="20"`), so the value reaches the element with its type.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: default

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZStack, ZSwitch } from '@zelviora/angular';

@Component({
  selector: 'demo-switch-default',
  imports: [ZStack, ZSwitch],
  template: `
    <z-stack gap="sm">
      <z-switch name="notify" [checked]="on()" (zChange)="on.set($event.detail.checked)">Email notifications</z-switch>
      <p>Notifications are {{ on() ? 'on' : 'off' }}.</p>
    </z-stack>
  `,
})
export class SwitchDefault {
  readonly on = signal(false);
}

```

### Case: form

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
import { BooleanValueAccessor, ZButton, ZStack, ZSwitch } from '@zelviora/angular';

@Component({
  selector: 'demo-switch-form',
  imports: [ReactiveFormsModule, BooleanValueAccessor, ZButton, ZStack, ZSwitch],
  template: `
    <form #formEl [formGroup]="form" (ngSubmit)="submit(formEl)">
      <z-stack>
        <z-switch
          name="terms"
          value="accepted"
          [required]="true"
          formControlName="terms"
          [invalid]="form.controls.terms.invalid && form.controls.terms.touched"
        >Accept the terms</z-switch>
        <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
          <z-button type="submit">Submit</z-button>
          <z-button type="reset" variant="outline" tone="neutral">Reset</z-button>
        </z-stack>
        <p>FormData: {{ sent() || '(not submitted)' }}</p>
      </z-stack>
    </form>
  `,
})
export class SwitchForm {
  // Validators.requiredTrue, not Validators.required: Angular counts false as a value (F15).
  readonly form = new FormGroup({ terms: new FormControl(false, { nonNullable: true, validators: Validators.requiredTrue }) });
  readonly sent = signal('');

  submit(formEl: HTMLFormElement) {
    // Angular adds novalidate to the form, so the app blocks an invalid submit itself.
    if (this.form.invalid) {
      this.form.markAllAsTouched();
      return;
    }
    this.sent.set(JSON.stringify(Object.fromEntries(new FormData(formEl))));
  }
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack, ZSwitch } from '@zelviora/angular';

@Component({
  selector: 'demo-switch-states',
  imports: [ZStack, ZSwitch],
  template: `
    <z-stack gap="sm">
      <z-switch size="sm">Small</z-switch>
      <z-switch [checked]="true">Medium, on</z-switch>
      <z-switch size="lg" hint="Sent every Monday.">Large with a hint</z-switch>
      <z-switch [disabled]="true" [checked]="true">Disabled</z-switch>
      <z-switch [readonly]="true" [checked]="true">Read-only</z-switch>
      <z-switch labelPlacement="start">Label before the switch</z-switch>
    </z-stack>
  `,
})
export class SwitchStates {}

```


================================================================================
# COMPONENT: TABLE
================================================================================

## Documentation

# table — Angular

Processed requirements of [`<z-table>`](../../../../../requirements/04-components/data-display/table.md) for Angular
(`@zelviora/angular`, standalone components, Angular 18–21).

## Usage

```ts
import { Component } from '@angular/core';
import { ZTable } from '@zelviora/angular';

@Component({
  selector: 'app-users',
  imports: [ZTable],
  template: `<z-table caption="Users" rowHeader="name" [columns]="columns" [rows]="rows"></z-table>`,
})
export class Users {
  columns = [
    { key: 'name', header: 'Name', sortable: true },
    { key: 'age', header: 'Age', type: 'number' as const },
  ];
  rows = [{ key: 'u1', name: 'Nguyen Van An', age: 34 }];
}
```

`columns`, `rows`, `sort`, `rowParts` and `cellParts` are objects and functions: bind them with `[prop]="…"` (property
binding). Custom cell content uses per-cell slots rendered with `@for` and `[attr.slot]` (or import `ZTableCellTemplate` from `@zelviora/angular` for `<ng-template zTableCell="actions" let-row>`):

```html
<z-table caption="Users" [columns]="columns" [rows]="rows">
  @for (r of rows; track r.key) {
    <z-button [attr.slot]="'cell:' + r.key + ':actions'" size="sm">Edit</z-button>
  }
</z-table>
```

Conditional formatting: `rowParts` / `cellParts` add part names, and the app styles them from its own stylesheet (the
`conditional` demo uses the class `demo-table-invoices` of the shared `demo.css`, L-DOC-07):

```css
.demo-table-invoices::part(row overdue) { background: var(--z-color-destructive-soft); }
.demo-table-invoices::part(cell negative) { color: var(--z-color-destructive-text); }
```

## Binding

No model event and no value accessor (spec §12). Two-way sort: bind `[sort]` and update it from `(zSortChange)`
(`$event.detail.sort` can be assigned back as is).

## Events

| Angular output | Event | Detail |
|---|---|---|
| `(zSortChange)` | `zSortChange` | `{ sort: { key, direction }[] }` (one entry or empty) |

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `table-basic.ts` | D-1 Default, D-21 Row header |
| `appearance` | `table-appearance.ts` | D-3 striped / bordered, D-5 Sizes |
| `states` | `table-states.ts` | D-6 States, D-20 Empty / loading |
| `controlled` | `table-controlled.ts` | D-9 Controlled (`processing="manual"`) |
| `grouped` | `table-grouped.ts` | D-23 Grouped header |
| `pinned` | `table-pinned.ts` | D-24 Pinned columns, D-14 sticky header, D-17 composition (button in a cell slot) |
| `formatting` | `table-formatting.ts` | D-25 Formatting, D-19 i18n |
| `conditional` | `table-conditional.ts` | D-26 Conditional style, D-18 customization (`::part`, class `demo-table-invoices` of `demo.css`) |
| `footer` | `table-footer.ts` | D-22 Footer, D-21 hidden caption |

Not yet covered: D-2 playground, D-11 RTL with Arabic data, D-12 dark, D-13 brand showcase, D-15 keyboard-only,
D-16 density (see the config-provider density demo), D-17 with badge and avatar (components not available yet).

## Differences

- Boolean and number props are bound with `[prop]="…"` (`[striped]="true"`), so the value reaches the element with its type.
- Native attributes that change at runtime (`lang` in the `formatting` demo) use `[attr.lang]`.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: appearance

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack, ZTable } from '@zelviora/angular';

const columns = [
  { key: 'item', header: 'Item' },
  { key: 'qty', header: 'Quantity', type: 'number' as const },
  { key: 'price', header: 'Price', format: { type: 'currency' as const, currency: 'USD' } },
];

const rows = [
  { key: '1', item: 'Keyboard', qty: 2, price: 49.9 },
  { key: '2', item: 'Mouse', qty: 5, price: 19.5 },
  { key: '3', item: 'Monitor', qty: 1, price: 219 },
];

@Component({
  selector: 'demo-table-appearance',
  imports: [ZStack, ZTable],
  template: `
    <z-stack gap="lg">
      <z-table caption="Small, striped" size="sm" [striped]="true" [columns]="columns" [rows]="rows"></z-table>
      <z-table caption="Medium, bordered" [bordered]="true" [columns]="columns" [rows]="rows"></z-table>
      <z-table caption="Large, striped and bordered" size="lg" [striped]="true" [bordered]="true" [columns]="columns" [rows]="rows"></z-table>
    </z-stack>
  `,
})
export class TableAppearance {
  readonly columns = columns;
  readonly rows = rows;
}

```

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZTable } from '@zelviora/angular';

const columns = [
  { key: 'name', header: 'Name', sortable: true },
  { key: 'email', header: 'Email' },
  { key: 'role', header: 'Role', sortable: true },
  { key: 'age', header: 'Age', type: 'number' as const, sortable: true },
];

const rows = [
  { key: 'u1', name: 'Nguyen Van An', email: 'an@example.com', role: 'Admin', age: 34 },
  { key: 'u2', name: 'Tran Thi Binh', email: 'binh@example.com', role: 'Editor', age: 28 },
  { key: 'u3', name: 'Le Van Cuong', email: 'cuong@example.com', role: 'Viewer', age: 41 },
  { key: 'u4', name: 'Pham Thi Dung', email: 'dung@example.com', role: 'Editor', age: 25 },
  { key: 'u5', name: 'Hoang Van Em', email: 'em@example.com', role: 'Viewer', age: 37 },
];

@Component({
  selector: 'demo-table-basic',
  imports: [ZTable],
  template: `<z-table caption="Users" rowHeader="name" [columns]="columns" [rows]="rows"></z-table>`,
})
export class TableBasic {
  readonly columns = columns;
  readonly rows = rows;
}

```

### Case: conditional

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZTable } from '@zelviora/angular';

type Invoice = { key: string; number: string; due: string; balance: number; overdue: boolean };

const columns = [
  { key: 'number', header: 'Invoice' },
  { key: 'due', header: 'Due', format: { type: 'date' as const } },
  { key: 'state', header: 'State', format: (_: unknown, r: Invoice) => (r.overdue ? 'Overdue' : 'Open') },
  { key: 'balance', header: 'Balance', format: { type: 'currency' as const, currency: 'USD' } },
];

const rows: Invoice[] = [
  { key: 'i1', number: 'INV-001', due: '2026-08-01', balance: 120, overdue: true },
  { key: 'i2', number: 'INV-002', due: '2026-11-15', balance: -35, overdue: false },
  { key: 'i3', number: 'INV-003', due: '2026-12-01', balance: 980, overdue: false },
];

// rowParts / cellParts add part names; demo.css styles them on .demo-table-invoices with ::part(row overdue) and
// ::part(cell negative). Color is decoration only: the State column and the minus sign carry the meaning (WCAG 1.4.1).

@Component({
  selector: 'demo-table-conditional',
  imports: [ZTable],
  template: `
    <z-table
      class="demo-table-invoices"
      caption="Invoices"
      [columns]="columns"
      [rows]="rows"
      [rowParts]="rowParts"
      [cellParts]="cellParts"
    ></z-table>
  `,
})
export class TableConditional {
  readonly columns = columns;
  readonly rows = rows;
  readonly rowParts = (r: Invoice) => (r.overdue ? ['overdue'] : []);
  readonly cellParts = (r: Invoice, col: string) => (col === 'balance' && r.balance < 0 ? ['negative'] : []);
}

```

### Case: controlled

#### Angular
```typescript
import { Component, computed, signal } from '@angular/core';
import { ZStack, ZTable } from '@zelviora/angular';

const columns = [
  { key: 'city', header: 'City', sortable: true },
  { key: 'population', header: 'Population', type: 'number' as const, sortable: true },
];

const data = [
  { key: 'hn', city: 'Ha Noi', population: 8435700 },
  { key: 'hcm', city: 'Ho Chi Minh City', population: 9389700 },
  { key: 'dn', city: 'Da Nang', population: 1220200 },
  { key: 'hp', city: 'Hai Phong', population: 2088000 },
];

type Sort = Array<{ key: string; direction: 'ascending' | 'descending' }>;

/** `processing="manual"`: the table only reports the sort; the app orders the rows (as a server would). */
@Component({
  selector: 'demo-table-controlled',
  imports: [ZStack, ZTable],
  template: `
    <z-stack gap="sm">
      <z-table caption="Cities" processing="manual" [sort]="sort()" [columns]="columns" [rows]="rows()" (zSortChange)="sort.set($event.detail.sort)"></z-table>
      <p>Current sort: {{ sort()[0] ? sort()[0].key + ' ' + sort()[0].direction : 'none' }}</p>
    </z-stack>
  `,
})
export class TableControlled {
  readonly columns = columns;
  readonly sort = signal<Sort>([{ key: 'population', direction: 'descending' }]);
  readonly rows = computed(() => {
    const s = this.sort()[0];
    if (!s) return data;
    const sign = s.direction === 'ascending' ? 1 : -1;
    return [...data].sort((a, b) => {
      const x = a[s.key as keyof typeof a], y = b[s.key as keyof typeof b];
      return sign * (typeof x === 'number' && typeof y === 'number' ? x - y : String(x).localeCompare(String(y)));
    });
  });
}

```

### Case: footer

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZTable } from '@zelviora/angular';

const columns = [
  { key: 'item', header: 'Item' },
  { key: 'amount', header: 'Amount', format: { type: 'currency' as const, currency: 'USD' } },
];

const rows = [
  { key: 'a', item: 'Hosting', amount: 120 },
  { key: 'b', item: 'Domains', amount: 24 },
  { key: 'c', item: 'Support', amount: 300 },
];

@Component({
  selector: 'demo-table-footer',
  imports: [ZTable],
  template: `
    <z-table caption="Monthly costs" [hideCaption]="true" rowHeader="item" [columns]="columns" [rows]="rows">
      <strong slot="footer">Total: {{ total }}</strong>
    </z-table>
  `,
})
export class TableFooter {
  readonly columns = columns;
  readonly rows = rows;
  readonly total = new Intl.NumberFormat('en', { style: 'currency', currency: 'USD' }).format(rows.reduce((s, r) => s + r.amount, 0));
}

```

### Case: formatting

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZStack, ZTable } from '@zelviora/angular';

const columns = [
  { key: 'name', header: 'Order' },
  { key: 'qty', header: 'Quantity', format: { type: 'number' as const } },
  { key: 'vnd', header: 'Total (VND)', format: { type: 'currency' as const, currency: 'VND' } },
  { key: 'usd', header: 'Total (USD)', format: { type: 'currency' as const, currency: 'USD' } },
  { key: 'discount', header: 'Discount', format: { type: 'percent' as const } },
  { key: 'date', header: 'Date', format: { type: 'date' as const }, sortable: true },
  { key: 'updated', header: 'Updated', format: { type: 'datetime' as const } },
  { key: 'tags', header: 'Tags', format: { type: 'list' as const } },
];

const rows = [
  { key: 'o1', name: 'A-1001', qty: 1250, vnd: 1500000, usd: 59.5, discount: 0.1, date: '2026-03-04', updated: '2026-03-04T09:30:00Z', tags: ['gift', 'express'] },
  { key: 'o2', name: 'A-1002', qty: 3, vnd: 245000, usd: 9.75, discount: 0.25, date: '2026-01-15', updated: '2026-01-16T14:05:00Z', tags: ['standard'] },
];

@Component({
  selector: 'demo-table-formatting',
  imports: [ZButton, ZStack, ZTable],
  template: `
    <z-stack [attr.lang]="lang()" gap="sm" align-items="start">
      <z-button variant="outline" tone="neutral" (click)="lang.set(lang() === 'de' ? 'en' : 'de')">
        Switch to {{ lang() === 'de' ? 'English' : 'German' }}
      </z-button>
      <z-table caption="Orders" [columns]="columns" [rows]="rows"></z-table>
    </z-stack>
  `,
})
export class TableFormatting {
  readonly columns = columns;
  readonly rows = rows;
  readonly lang = signal<'en' | 'de'>('en');
}

```

### Case: grouped

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZTable } from '@zelviora/angular';

// Three header levels: General > (Name, Contact > (Email, Phone)), nested data read through `join: 'path'`.
const columns = [
  {
    key: 'general', header: 'General information', join: 'path' as const, columns: [
      { key: 'name', header: 'Full name' },
      { key: 'contact', header: 'Contact', join: 'path' as const, columns: [
        { key: 'email', header: 'Email' },
        { key: 'phone', header: 'Phone' },
      ] },
    ],
  },
  { key: 'team', header: 'Team', sortable: true },
];

const rows = [
  { key: 'e1', general: { name: 'Nguyen Van An', contact: { email: 'an@example.com', phone: '0901 234 567' } }, team: 'Platform' },
  { key: 'e2', general: { name: 'Tran Thi Binh', contact: { email: 'binh@example.com', phone: '0912 345 678' } }, team: 'Design' },
];

@Component({
  selector: 'demo-table-grouped',
  imports: [ZTable],
  template: `<z-table caption="Staff" rowHeader="general.name" [columns]="columns" [rows]="rows"></z-table>`,
})
export class TableGrouped {
  readonly columns = columns;
  readonly rows = rows;
}

```

### Case: pinned

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZContainer, ZTable } from '@zelviora/angular';

const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];

const columns = [
  { key: 'product', header: 'Product', width: '10rem', pinned: 'start' as const },
  ...months.map((m) => ({ key: m.toLowerCase(), header: m, type: 'number' as const, width: '6rem' })),
  { key: 'actions', header: 'Actions', width: '6rem', pinned: 'end' as const, slot: true },
];

const rows = ['Laptop', 'Tablet', 'Phone', 'Monitor'].map((product, i) => ({
  key: `p${i}`,
  product,
  ...Object.fromEntries(months.map((m, j) => [m.toLowerCase(), 100 + ((i + 1) * (j + 3) * 37) % 900])),
}));

// A 40rem frame, narrower than the 14 columns: the table scrolls inline with pinned edges.
@Component({
  selector: 'demo-table-pinned',
  imports: [ZButton, ZContainer, ZTable],
  template: `
    <z-container size="sm" padding="none">
      <z-table caption="Monthly sales" [columns]="columns" [rows]="rows" [stickyHeader]="true" maxHeight="16rem">
        @for (r of rows; track r.key) {
          <z-button [attr.slot]="'cell:' + r.key + ':actions'" size="sm" variant="ghost">Edit</z-button>
        }
      </z-table>
    </z-container>
  `,
})
export class TablePinned {
  readonly columns = columns;
  readonly rows = rows;
}

```

### Case: states

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZStack, ZTable } from '@zelviora/angular';

const columns = [
  { key: 'name', header: 'Name' },
  { key: 'status', header: 'Status' },
];

const data = [
  { key: 'a', name: 'Backup', status: 'Done' },
  { key: 'b', name: 'Import', status: 'Running' },
];

@Component({
  selector: 'demo-table-states',
  imports: [ZButton, ZStack, ZTable],
  template: `
    <z-stack gap="lg">
      <z-table caption="Loading without rows" [loading]="true" [columns]="columns" [rows]="[]"></z-table>
      <z-table caption="Empty" [columns]="columns" [rows]="[]" emptyText="No jobs yet"></z-table>
      <z-stack gap="sm" align-items="start">
        <z-button variant="outline" tone="neutral" (click)="loading.set(!loading())">
          {{ loading() ? 'Stop loading' : 'Reload' }}
        </z-button>
        <z-table caption="Loading with rows (rows are dimmed)" [loading]="loading()" [columns]="columns" [rows]="data"></z-table>
      </z-stack>
    </z-stack>
  `,
})
export class TableStates {
  readonly columns = columns;
  readonly data = data;
  readonly loading = signal(false);
}

```


================================================================================
# COMPONENT: TABS
================================================================================

## Documentation

# tabs — Angular

Processed requirements of [`<z-tabs>`](../../../../../requirements/04-components/navigation/tabs.md) and its parts
(`z-tabs-list`, `z-tabs-trigger`, `z-tabs-panel`) for Angular (`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component, signal } from '@angular/core';
import { ZTabs, ZTabsList, ZTabsPanel, ZTabsTrigger } from '@zelviora/angular';

@Component({
  selector: 'app-settings',
  imports: [ZTabs, ZTabsList, ZTabsPanel, ZTabsTrigger],
  template: `
    <z-tabs [value]="value()" (zChange)="value.set($event.detail.value)">
      <z-tabs-list label="Settings">
        <z-tabs-trigger value="a">General</z-tabs-trigger>
      </z-tabs-list>
      <z-tabs-panel value="a">…</z-tabs-panel>
    </z-tabs>
  `,
})
export class Settings { readonly value = signal('a'); }
```

## Binding and events

| Input | Output | Detail |
|---|---|---|
| `[value]` | `(zChange)` | `{ value, reason }` |
| — | `(zBeforeClose)` (cancelable) | `{ value }` |
| — | `(zClose)` | `{ value }`: remove the trigger and its panel from state |

`z-tabs` is not a form control: no value accessor, bind `[value]` + `(zChange)`.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `tabs-default.ts` | D-1 Default |
| `vertical` | `tabs-vertical.ts` | D-21 Vertical, D-15 Keyboard (manual), D-7 Disabled |
| `closable` | `tabs-closable.ts` | D-23 Closable / add, D-14 overflow menu, D-9 Controlled |
| `overflow` | `tabs-overflow.ts` | D-14 Long content (`overflow="scroll"` and `overflow="menu"`) |

## Differences

- Lazy panels: with Angular, render panel content with `@if` (keep a set of opened tabs); `<template>` is for plain HTML.
- Boolean props are bound with `[prop]="true"` (`[closable]="true"`, `[disabled]="true"`).
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: closable

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZTabs, ZTabsList, ZTabsPanel, ZTabsTrigger } from '@zelviora/angular';

let next = 4;

@Component({
  selector: 'demo-tabs-closable',
  imports: [ZButton, ZTabs, ZTabsList, ZTabsPanel, ZTabsTrigger],
  template: `
    <z-tabs
      [value]="value()"
      overflow="menu"
      (zChange)="value.set($event.detail.value)"
      (zClose)="close($event.detail.value)"
    >
      <z-button slot="end" variant="ghost" tone="neutral" size="sm" label="Add tab" (click)="add()">+</z-button>
      <z-tabs-list label="Open documents">
        @for (id of tabs(); track id) {
          <z-tabs-trigger [value]="id" [closable]="true">Document {{ id }}</z-tabs-trigger>
        }
      </z-tabs-list>
      @for (id of tabs(); track id) {
        <z-tabs-panel [value]="id">Content of document {{ id }}. Press Delete on a tab to close it.</z-tabs-panel>
      }
    </z-tabs>
  `,
})
export class TabsClosable {
  readonly tabs = signal(['1', '2', '3']);
  readonly value = signal('1');

  add() {
    const id = String(next++);
    this.tabs.update((t) => [...t, id]);
    this.value.set(id);
  }

  close(id: string) {
    this.tabs.update((t) => t.filter((x) => x !== id));
  }
}

```

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZTabs, ZTabsList, ZTabsPanel, ZTabsTrigger } from '@zelviora/angular';

@Component({
  selector: 'demo-tabs-default',
  imports: [ZTabs, ZTabsList, ZTabsPanel, ZTabsTrigger],
  template: `
    <z-tabs defaultValue="general">
      <z-tabs-list label="Account settings">
        <z-tabs-trigger value="general">General</z-tabs-trigger>
        <z-tabs-trigger value="security">Security</z-tabs-trigger>
        <z-tabs-trigger value="notifications">Notifications</z-tabs-trigger>
      </z-tabs-list>
      <z-tabs-panel value="general">Name, language and time zone.</z-tabs-panel>
      <z-tabs-panel value="security">Password and two-factor authentication.</z-tabs-panel>
      <z-tabs-panel value="notifications">Email and push notifications.</z-tabs-panel>
    </z-tabs>
  `,
})
export class TabsDefault {}

```

### Case: overflow

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack, ZTabs, ZTabsList, ZTabsPanel, ZTabsTrigger } from '@zelviora/angular';

@Component({
  selector: 'demo-tabs-overflow',
  imports: [ZStack, ZTabs, ZTabsList, ZTabsPanel, ZTabsTrigger],
  template: `
    <z-stack orientation="vertical" gap="lg" class="demo-narrow">
      @for (overflow of modes; track overflow) {
        <z-tabs defaultValue="January" [overflow]="overflow">
          <z-tabs-list [label]="'Monthly reports (' + overflow + ')'">
            @for (m of months; track m) {
              <z-tabs-trigger [value]="m">{{ m }} report</z-tabs-trigger>
            }
          </z-tabs-list>
          @for (m of months; track m) {
            <z-tabs-panel [value]="m">
              Sales report for {{ m }}. {{ overflow === 'menu' ? 'The more button lists the tabs that are out of view.' : 'Use the scroll buttons or the arrow keys.' }}
            </z-tabs-panel>
          }
        </z-tabs>
      }
    </z-stack>
  `,
})
export class TabsOverflow {
  readonly months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
  readonly modes = ['scroll', 'menu'] as const;
}

```

### Case: vertical

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZTabs, ZTabsList, ZTabsPanel, ZTabsTrigger } from '@zelviora/angular';

@Component({
  selector: 'demo-tabs-vertical',
  imports: [ZTabs, ZTabsList, ZTabsPanel, ZTabsTrigger],
  template: `
    <z-tabs orientation="vertical" variant="soft" activationMode="manual" defaultValue="profile">
      <z-tabs-list label="Profile sections">
        <z-tabs-trigger value="profile">Profile</z-tabs-trigger>
        <z-tabs-trigger value="billing">Billing</z-tabs-trigger>
        <z-tabs-trigger value="team" [disabled]="true">Team</z-tabs-trigger>
      </z-tabs-list>
      <z-tabs-panel value="profile">Arrow keys move focus; Enter or Space selects (manual activation).</z-tabs-panel>
      <z-tabs-panel value="billing">Invoices and payment methods.</z-tabs-panel>
      <z-tabs-panel value="team">Team members.</z-tabs-panel>
    </z-tabs>
  `,
})
export class TabsVertical {}

```


================================================================================
# COMPONENT: TAG
================================================================================

## Documentation

# tag — Angular

Processed requirements of [`<z-tag>`](../../../../../requirements/04-components/data-display/tag.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-tag [removable]="true" value="vn" (zRemove)="remove($event.detail.value)">Vietnam</z-tag>
```

## Binding

No model event. The tag never removes itself: remove it from your list on `zRemove` and move the focus to the next tag.

## Events

`zRemove` `{ value }` (cancelable) on click, Enter, Space, Delete or Backspace on the remove button.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `tag-basic.ts` | D-1 Default |
| `variants` | `tag-variants.ts` | D-3 Variants, D-4 Tones, D-5 Sizes, D-7 Disabled |
| `removable` | `tag-removable.ts` | D-9 Controlled, D-14 Long content, D-15 Keyboard-only |
| `icon` | `tag-icon.ts` | D-21 With icon/avatar |


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack, ZTag } from '@zelviora/angular';

@Component({
  selector: 'demo-tag-basic',
  imports: [ZStack, ZTag],
  template: `
    <z-stack orientation="horizontal" gap="sm" [wrap]="true">
      <z-tag>New</z-tag>
      <z-tag tone="success">Approved</z-tag>
      <z-tag tone="warning">Pending</z-tag>
    </z-stack>
  `,
})
export class TagBasic {}

```

### Case: icon

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZAvatar, ZIcon, ZStack, ZTag } from '@zelviora/angular';

@Component({
  selector: 'demo-tag-icon',
  imports: [ZAvatar, ZIcon, ZStack, ZTag],
  template: `
    <z-stack orientation="horizontal" align-items="center" gap="sm" [wrap]="true">
      <z-tag tone="info">
        <z-icon slot="icon-start" name="chevron_right"></z-icon>
        Next
      </z-tag>
      <z-tag [removable]="true" value="an">
        <z-avatar slot="icon-start" size="xs" name="Anna Lee" alt=""></z-avatar>
        Anna Lee
      </z-tag>
    </z-stack>
  `,
})
export class TagIcon {}

```

### Case: removable

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZStack, ZTag, ZText } from '@zelviora/angular';

@Component({
  selector: 'demo-tag-removable',
  imports: [ZButton, ZStack, ZTag, ZText],
  template: `
    <z-stack gap="sm">
      <z-stack orientation="horizontal" gap="sm" [wrap]="true">
        @for (name of items(); track name) {
          <z-tag [removable]="true" [value]="name" (zRemove)="remove($event.detail.value)">{{ name }}</z-tag>
        }
      </z-stack>
      <z-stack orientation="horizontal" align-items="center" gap="sm">
        <z-text variant="muted" size="sm">{{ items().length }} selected</z-text>
        <z-button size="sm" variant="ghost" tone="neutral" (click)="items.set(provinces)">Reset</z-button>
      </z-stack>
    </z-stack>
  `,
})
export class TagRemovable {
  readonly provinces = ['London', 'Boston', 'Sydney', 'Toronto', 'San Francisco – Mission District Regional Office'];
  readonly items = signal(this.provinces);

  remove(value: string | undefined) {
    this.items.update((list) => list.filter((n) => n !== value));
  }
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack, ZTag } from '@zelviora/angular';

@Component({
  selector: 'demo-tag-variants',
  imports: [ZStack, ZTag],
  template: `
    <z-stack gap="md">
      @for (variant of variants; track variant) {
        <z-stack orientation="horizontal" gap="sm" [wrap]="true">
          @for (tone of tones; track tone) {
            <z-tag [variant]="variant" [tone]="tone">{{ tone }}</z-tag>
          }
        </z-stack>
      }
      <z-stack orientation="horizontal" align-items="center" gap="sm">
        @for (size of sizes; track size) {
          <z-tag [size]="size" [removable]="true">Size {{ size }}</z-tag>
        }
        <z-tag [removable]="true" [disabled]="true">Disabled</z-tag>
      </z-stack>
    </z-stack>
  `,
})
export class TagVariants {
  readonly variants = ['soft', 'solid', 'outline'] as const;
  readonly tones = ['neutral', 'primary', 'success', 'warning', 'destructive', 'info'] as const;
  readonly sizes = ['sm', 'md', 'lg'] as const;
}

```


================================================================================
# COMPONENT: TAGS-INPUT
================================================================================

## Documentation

# tags-input — Angular

Processed requirements of [`<z-tags-input>`](../../../../../requirements/04-components/form/tags-input.md)
for Angular (`@zelviora/angular`).

## Usage

```html
<z-tags-input name="keywords" label="Keywords" [(ngModel)]="tags"></z-tags-input>
```

## Binding

| Value accessor | Model | Event | Detail |
|---|---|---|---|
| `SelectValueAccessor` | `[(ngModel)]` / `formControl` (`string[]`) | `(zChange)` | `{ value, reason }` |

## Events

`(zSearch)`, `(zChange)`, `(zRemove)`, `(zClear)`, `(zError)`.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `tags-input-default.ts` | D-1 Default, D-20 Empty with placeholder, clear all |
| `validate` | `tags-input-validate.ts` | D-21 Validate email, delimiters `, ; space`, rejected tags (error event) |
| `editable` | `tags-input-editable.ts` | D-22 Editable, `max-count` / `min-count` |
| `form` | `tags-input-form.ts` | D-10 In form (`getAll`), D-8 Error (required), D-17 Composition (field "Recipients") |

## Differences

- Boolean, number, array and function props are bound with `[prop]="…"` so the value reaches the element with its type.
- `delimiters`, `validate` and `transform` are properties (not attributes).
- Text left in the input is not submitted (enable `addOnBlur` to add it on blur).
- Tags are rendered by the component itself, not by the tag component yet.
- Form reset does not emit events: reset the bound value yourself.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SelectValueAccessor, ZStack, ZTagsInput } from '@zelviora/angular';

/** Enter or a comma adds a tag; Backspace in the empty input reaches the last tag; `[(ngModel)]` with an array. */
@Component({
  selector: 'demo-tags-input-default',
  imports: [FormsModule, SelectValueAccessor, ZStack, ZTagsInput],
  template: `
    <z-stack class="demo-narrow">
      <z-tags-input label="Keywords" placeholder="Type, then press Enter" [clearable]="true" [(ngModel)]="tags"></z-tags-input>
      <span>Value: {{ tags.length ? tags.join(' | ') : 'none' }}</span>
    </z-stack>
  `,
})
export class TagsInputDefault {
  tags: string[] = [];
}

```

### Case: editable

#### Angular
```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SelectValueAccessor, ZStack, ZTagsInput } from '@zelviora/angular';

/** Double-click, Enter or F2 on a tag edits it; at most 5 tags, at least 2. */
@Component({
  selector: 'demo-tags-input-editable',
  imports: [FormsModule, SelectValueAccessor, ZStack, ZTagsInput],
  template: `
    <z-stack class="demo-narrow">
      <z-tags-input label="Labels" hint="2 to 5 labels; double-click a tag to edit it" [editable]="true" [maxCount]="5" [minCount]="2" [(ngModel)]="labels"></z-tags-input>
    </z-stack>
  `,
})
export class TagsInputEditable {
  labels: string[] = ['urgent', 'frontend', 'in progress'];
}

```

### Case: form

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZField, ZStack, ZTagsInput } from '@zelviora/angular';

/**
 * Native form: one FormData entry per tag (getAll); required inside a field; reset.
 * FormsModule is not imported, so the form stays native and the element submits its own FormData entries.
 */
@Component({
  selector: 'demo-tags-input-form',
  imports: [ZButton, ZField, ZStack, ZTagsInput],
  template: `
    <form class="demo-narrow" (submit)="submit($event)">
      <z-stack>
        <z-field label="Recipients" hint="Press Enter after each address" [required]="true">
          <z-tags-input name="to" [required]="true"></z-tags-input>
        </z-field>
        <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
          <z-button type="submit">Submit</z-button>
          <z-button type="reset" variant="outline" tone="neutral">Reset</z-button>
        </z-stack>
        @if (sent()) {
          <output>{{ sent() }}</output>
        }
      </z-stack>
    </form>
  `,
})
export class TagsInputForm {
  readonly sent = signal('');

  submit(e: Event) {
    e.preventDefault();
    this.sent.set(JSON.stringify(new FormData(e.currentTarget as HTMLFormElement).getAll('to')));
  }
}

```

### Case: validate

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZStack, ZTagsInput } from '@zelviora/angular';

const DELIMITERS = [',', ';', ' '];
const isEmail = (tag: string) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(tag) || 'Invalid email';

/** Every tag is checked by `validate`; comma, semicolon and space add; rejected tags raise zError. */
@Component({
  selector: 'demo-tags-input-validate',
  imports: [ZStack, ZTagsInput],
  template: `
    <z-stack class="demo-narrow">
      <z-tags-input
        label="Email"
        hint="Paste or type addresses separated by , ; or a space"
        [delimiters]="delimiters"
        [validate]="validate"
        (zError)="error.set($event.detail.error.reason + ': ' + $event.detail.error.tag)"
      ></z-tags-input>
      <span>Last rejection: {{ error() || 'none' }}</span>
    </z-stack>
  `,
})
export class TagsInputValidate {
  readonly delimiters = DELIMITERS;
  readonly validate = isEmail;
  readonly error = signal('');
}

```


================================================================================
# COMPONENT: TERMINAL
================================================================================

## Documentation

# terminal — Angular (`@experimental`)

> **Experimental (`@experimental`):** `<z-terminal>` (`ZTerminal`) ships with an experimental stability tier in v0.1.x. Its properties, events, and keyboard ergonomics may evolve prior to v1.0 stabilization.

Interactive command-line transcript and prompt component (`<z-terminal>`) for Angular 18–21 (`@zelviora/angular`).


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import {
  ZStack,
  ZTerminal,
  ZText,
  type ZTerminalCommandDefinition,
  type ZTerminalEntry,
} from '@zelviora/angular';

@Component({
  selector: 'demo-terminal-basic',
  imports: [ZStack, ZTerminal, ZText],
  template: `
    <z-stack gap="sm">
      <z-terminal
        class="demo-terminal-frame"
        heading="zelviora-cli — zsh"
        cwd="~/zelviora"
        welcomeMessage="zelviora Cloud Shell v2.4 — Type 'help' to list commands or press Tab to autocomplete."
        [entries]="initialEntries"
        [commands]="commands"
      ></z-terminal>
      <z-text size="sm" variant="muted">
        Try typing <code>help</code>, <code>deploy --env prod</code>, <code>ArrowUp</code> for history, or <code>Ctrl+L</code> to clear.
      </z-text>
    </z-stack>
  `,
})
export class TerminalBasic {
  readonly initialEntries: ZTerminalEntry[] = [
    { id: 'init-1', kind: 'command', text: 'status', prompt: '$', cwd: '~/zelviora' },
    {
      id: 'init-2',
      kind: 'output',
      text: '\u001b[1;32m● healthy\u001b[0m  api-gateway (v2.4.1) · 3/3 replicas ready · latency 14ms',
    },
  ];

  readonly commands: ZTerminalCommandDefinition[] = [
    {
      name: 'status',
      aliases: ['st'],
      description: 'Check cluster service health',
      completions: ['--json', '--verbose'],
      handler: (_cmd, args) =>
        args.includes('--json')
          ? '{\n  "service": "api-gateway",\n  "status": "healthy",\n  "replicas": 3\n}'
          : '\u001b[1;32m● healthy\u001b[0m  api-gateway (v2.4.1) · 3/3 replicas ready',
    },
    {
      name: 'deploy',
      description: 'Trigger an environment rollout',
      usage: 'deploy [--env staging|prod]',
      completions: ['--env', 'staging', 'prod'],
      handler: (_cmd, args) => {
        const envIdx = args.indexOf('--env');
        const target = envIdx >= 0 && args[envIdx + 1] ? args[envIdx + 1] : args[0] || 'staging';
        return {
          kind: 'success',
          text: `Rollout queued for environment "${target}" (build #482).`,
        };
      },
    },
    {
      name: 'whoami',
      description: 'Print active operator identity',
      handler: () => 'operator@zelviora.dev (role: platform-admin)',
    },
    {
      name: 'echo',
      description: 'Print arguments to standard output',
      handler: (_cmd, args) => args.join(' '),
    },
  ];
}

```

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import {
  ZStack,
  ZTerminal,
  type ZTerminalCommandDefinition,
  type ZTerminalEntry,
} from '@zelviora/angular';

@Component({
  selector: 'demo-terminal-i18n',
  imports: [ZStack, ZTerminal],
  template: `
    <z-stack>
      <z-terminal
        class="demo-terminal-frame"
        lang="vi"
        cwd="~/du-an"
        welcomeMessage="Chào mừng đến với cửa sổ dòng lệnh zelviora. Gõ 'help' để xem các lệnh hỗ trợ."
        [entries]="nhatKyDau"
        [commands]="lenhHoTro"
      ></z-terminal>
    </z-stack>
  `,
})
export class TerminalI18n {
  readonly nhatKyDau: ZTerminalEntry[] = [
    { id: 'vi-1', kind: 'command', text: 'trang-thai', prompt: '$', cwd: '~/du-an' },
    {
      id: 'vi-2',
      kind: 'success',
      text: 'Hệ thống đang hoạt động ổn định (3/3 máy chủ sẵn sàng).',
    },
  ];

  readonly lenhHoTro: ZTerminalCommandDefinition[] = [
    {
      name: 'trang-thai',
      description: 'Kiểm tra tình trạng cụm máy chủ',
      handler: () => ({
        kind: 'success',
        text: 'Tất cả dịch vụ phản hồi bình thường (độ trễ trung bình 12ms).',
      }),
    },
    {
      name: 'phien-ban',
      description: 'Xem phiên bản hệ thống hiện tại',
      handler: () => 'zelviora CLI phiên bản 0.1.0 (nhân Linux x86_64)',
    },
  ];
}

```

### Case: readonly

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import {
  ZButton,
  ZStack,
  ZTerminal,
  type ZTerminalEntry,
  type ZTerminalTheme,
} from '@zelviora/angular';

@Component({
  selector: 'demo-terminal-readonly',
  imports: [ZButton, ZStack, ZTerminal],
  template: `
    <z-stack gap="sm">
      <z-stack orientation="horizontal" align-items="center" gap="sm" [wrap]="true">
        <z-button
          [variant]="theme() === 'dark' ? 'solid' : 'outline'"
          size="sm"
          (click)="theme.set('dark')"
        >
          Dark
        </z-button>
        <z-button
          [variant]="theme() === 'light' ? 'solid' : 'outline'"
          size="sm"
          (click)="theme.set('light')"
        >
          Light
        </z-button>
        <z-button
          [variant]="theme() === 'auto' ? 'solid' : 'outline'"
          size="sm"
          (click)="theme.set('auto')"
        >
          Auto
        </z-button>
        <z-button variant="soft" size="sm" (click)="appendLog()">Append log line</z-button>
      </z-stack>
      <z-terminal
        class="demo-terminal-frame"
        heading="k8s-pod/api-gateway-7f9c — logs"
        [theme]="theme()"
        [readonly]="true"
        [timestamps]="true"
        [entries]="entries()"
      ></z-terminal>
    </z-stack>
  `,
})
export class TerminalReadonly {
  readonly theme = signal<ZTerminalTheme>('dark');

  readonly entries = signal<ZTerminalEntry[]>([
    {
      id: 'log-1',
      kind: 'output',
      timestamp: '08:41:10',
      text: '\u001b[1;34mINFO\u001b[0m  [http] Listening on http://0.0.0.0:8080 (env: production)',
    },
    {
      id: 'log-2',
      kind: 'output',
      timestamp: '08:41:12',
      text: '\u001b[1;32mREADY\u001b[0m [db] Connection pool initialized (12 active connections)',
    },
    {
      id: 'log-3',
      kind: 'output',
      timestamp: '08:41:19',
      text: '\u001b[1;33mWARN\u001b[0m  [cache] Redis replica lag 48ms; retrying health probe',
    },
    {
      id: 'log-4',
      kind: 'output',
      timestamp: '08:41:24',
      text: '\u001b[1;31mERROR\u001b[0m [worker] Job #9042 timed out after 5000ms (requeued)',
    },
  ]);

  appendLog() {
    const list = this.entries();
    const nextIndex = list.length + 1;
    const now = new Date().toTimeString().slice(0, 8);
    this.entries.set([
      ...list,
      {
        id: `log-${nextIndex}`,
        kind: 'output',
        timestamp: now,
        text: `\u001b[1;32mOK\u001b[0m    [health] Heartbeat check #${nextIndex} completed in 6ms`,
      },
    ]);
  }
}

```

### Case: streaming

#### Angular
```typescript
import { Component, ElementRef, ViewChild } from '@angular/core';
import {
  ZButton,
  ZStack,
  ZTerminal,
  type ZTerminalCommandHandler,
  type ZTerminalEntry,
} from '@zelviora/angular';

type TerminalElement = HTMLElement & {
  execute(rawCommand: string): Promise<void>;
};

function waitStep(ms: number, signal: AbortSignal): Promise<void> {
  return new Promise((resolve, reject) => {
    const timer = window.setTimeout(resolve, ms);
    signal.addEventListener(
      'abort',
      () => {
        window.clearTimeout(timer);
        reject(new DOMException('Aborted', 'AbortError'));
      },
      { once: true },
    );
  });
}

@Component({
  selector: 'demo-terminal-streaming',
  imports: [ZButton, ZStack, ZTerminal],
  template: `
    <z-stack gap="sm">
      <z-stack orientation="horizontal" align-items="center" gap="sm" [wrap]="true">
        <z-button variant="solid" size="sm" (click)="runTask('build')">Run build</z-button>
        <z-button variant="outline" size="sm" (click)="runTask('test')">Run tests</z-button>
      </z-stack>
      <z-terminal
        #term
        class="demo-terminal-frame"
        heading="ci-runner — pipeline"
        cwd="~/workspace"
        [entries]="initialSteps"
        [commandHandler]="streamHandler"
      ></z-terminal>
    </z-stack>
  `,
})
export class TerminalStreaming {
  @ViewChild('term', { read: ElementRef }) termRef?: ElementRef<TerminalElement>;

  readonly initialSteps: ZTerminalEntry[] = [
    { id: 's-1', kind: 'system', text: 'Pipeline runner connected. Ready for build or test tasks.' },
  ];

  readonly streamHandler: ZTerminalCommandHandler = async (command, _args, _raw, ctx) => {
    if (command === 'clear') {
      ctx.clear();
      return;
    }
    if (command === 'build') {
      ctx.writeln('\u001b[1;36m[1/3]\u001b[0m Compiling design tokens and Stencil components…');
      await waitStep(350, ctx.signal);
      ctx.writeln('\u001b[1;36m[2/3]\u001b[0m Generating React, Vue, and Angular wrappers…');
      await waitStep(350, ctx.signal);
      ctx.writeln('\u001b[1;32m[3/3] ✓ Build succeeded in 1.42s (0 warnings)\u001b[0m');
      return;
    }
    if (command === 'test') {
      ctx.writeln('\u001b[1;34mRUN\u001b[0m  packages/core/terminal.spec.tsx');
      await waitStep(300, ctx.signal);
      ctx.writeln(' \u001b[1;32m✓\u001b[0m ANSI SGR parser & tokenizer (2ms)');
      await waitStep(300, ctx.signal);
      ctx.writeln(' \u001b[1;32m✓\u001b[0m Keyboard history, Tab completion & axe audit (18ms)');
      return { kind: 'success', text: 'Test Suites: 1 passed · Tests: 12 passed' };
    }
    return {
      kind: 'warning',
      text: `Unknown task "${command}". Try "build", "test", or "clear".`,
    };
  };

  runTask(cmd: string) {
    void this.termRef?.nativeElement.execute(cmd);
  }
}

```


================================================================================
# COMPONENT: TEXT
================================================================================

## Documentation

# text — Angular

Processed requirements of [`<z-text>`](../../../../../requirements/04-components/base/typography.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-text as="p" variant="muted">Updated at 08:00</z-text>
```

## Binding

No model event. `truncate` takes `true` (one line) or a line count.

## Events

None.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `variants` | `text-variants.ts` | D-3 Variants, D-4 Tones, D-5 Sizes |
| `truncate` | `text-truncate.ts` | D-14 Long content |
| `i18n` | `text-i18n.ts` | D-19 i18n (diacritics) |


## Examples & Implementation

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack, ZText } from '@zelviora/angular';

/** Vietnamese diacritics stack above and below the letters (Ễ Ỗ Ữ): no variant clips them. */
@Component({
  selector: 'demo-text-i18n',
  imports: [ZStack, ZText],
  template: `
    <z-stack gap="sm">
      @for (variant of variants; track variant) {
        <z-text as="p" [variant]="variant" lang="vi">{{ variant }}: Tiếng Việt có dấu chồng — Ễ Ỗ Ữ</z-text>
      }
    </z-stack>
  `,
})
export class TextI18n {
  readonly variants = ['body', 'muted', 'strong', 'caption', 'code'] as const;
}

```

### Case: truncate

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZHeading, ZStack, ZText } from '@zelviora/angular';

@Component({
  selector: 'demo-text-truncate',
  imports: [ZHeading, ZStack, ZText],
  template: `
    <z-stack gap="md" class="demo-narrow">
      <z-heading [level]="3" size="md" [truncate]="true">{{ long }}</z-heading>
      <z-text as="p" [truncate]="3">{{ long }} {{ long }}</z-text>
    </z-stack>
  `,
})
export class TextTruncate {
  readonly long =
    'San Francisco – Mission District Regional Office: consolidated report of revenue, costs and profit by month for fiscal year 2026, with a detailed breakdown by region and product group.';
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack, ZText } from '@zelviora/angular';

@Component({
  selector: 'demo-text-variants',
  imports: [ZStack, ZText],
  template: `
    <z-stack gap="sm">
      @for (variant of variants; track variant) {
        <z-text as="p" [variant]="variant">{{ variant }}: The quick brown fox jumps over the lazy dog</z-text>
      }
      <z-stack orientation="horizontal" gap="md" [wrap]="true">
        @for (tone of tones; track tone) {
          <z-text [tone]="tone">{{ tone }}</z-text>
        }
      </z-stack>
      <z-stack orientation="horizontal" align-items="center" gap="md">
        <z-text size="sm">Small</z-text>
        <z-text size="md">Medium</z-text>
        <z-text size="lg">Large</z-text>
      </z-stack>
    </z-stack>
  `,
})
export class TextVariants {
  readonly variants = ['body', 'muted', 'strong', 'caption', 'code'] as const;
  readonly tones = ['primary', 'success', 'warning', 'destructive', 'info'] as const;
}

```


================================================================================
# COMPONENT: TEXTAREA
================================================================================

## Documentation

# textarea — Angular

Processed requirements of [`<z-textarea>`](../../../../../requirements/04-components/form/textarea.md) for Angular (`@zelviora/angular`).

## Usage

```ts
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { TextValueAccessor, ZTextarea } from '@zelviora/angular';

@Component({
  selector: 'app-note',
  imports: [FormsModule, TextValueAccessor, ZTextarea],
  template: `<z-textarea label="Note" name="note" [autoResize]="true" [rows]="3" [maxRows]="8" [maxLength]="500" [showCount]="true" [(ngModel)]="note"></z-textarea>`,
})
export class Note { note = ''; }
```

Line endings in `value` are always `\n`. `minLength`/`maxLength` count graphemes (a line break counts as one).

## Binding

| Value accessor | Model | Model event |
|---|---|---|
| `TextValueAccessor` | `[(ngModel)]` / `formControl` (`string`) | `zInput` (`$event.detail.value`) |

## Events

`(zInput)`, `(zChange)` (blur after a change, clear), `(zClear)`. Enter inserts a line break; there is no implicit submit.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `textarea-basic.ts` | D-1 Default |
| `auto-resize` | `textarea-auto-resize.ts` | D-21 Auto resize |
| `count` | `textarea-count.ts` | D-22 Count, D-23 Clearable |

Not yet covered: D-3 variants, D-5 sizes, D-8 errors (same flow as input), D-11 RTL.

## Differences

- `wrap="hard"` is ignored (no `cols`), with a dev warning.
- Boolean and number props are bound with `[prop]="…"` (`[required]="true"`, `[maxLength]="20"`), so the value reaches the element with its type.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: auto-resize

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZTextarea } from '@zelviora/angular';

@Component({
  selector: 'demo-textarea-auto-resize',
  imports: [ZTextarea],
  template: `
    <div class="demo-narrow">
      <z-textarea label="Message" [autoResize]="true" [rows]="2" [maxRows]="6" hint="Grows from 2 to 6 lines, then scrolls"></z-textarea>
    </div>
  `,
})
export class TextareaAutoResize {}

```

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZTextarea } from '@zelviora/angular';

@Component({
  selector: 'demo-textarea-basic',
  imports: [ZTextarea],
  template: `<z-textarea label="Note" name="note" placeholder="Anything we should know?"></z-textarea>`,
})
export class TextareaBasic {}

```

### Case: count

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZTextarea } from '@zelviora/angular';

@Component({
  selector: 'demo-textarea-count',
  imports: [ZTextarea],
  template: `
    <div class="demo-narrow">
      <z-textarea label="Review" name="review" [showCount]="true" [clearable]="true" [maxLength]="200" [minLength]="20" value="The pho was great 🍜"></z-textarea>
    </div>
  `,
})
export class TextareaCount {}

```


================================================================================
# COMPONENT: THEME-RIVER-CHART
================================================================================

## Documentation

# Theme river chart (`<z-theme-river-chart>`)

Streamgraph flow over a continuous time axis showing evolving topic or category volumes.

## Installation & Import

```tsx
// React (@zelviora/react-chart)
import { ZThemeRiverChart } from '@zelviora/react-chart';

// Vue 3 (@zelviora/vue-chart)
import { ZThemeRiverChart } from '@zelviora/vue-chart';

// Angular (@zelviora/angular-chart)
import { ZThemeRiverChart } from '@zelviora/angular-chart';

// Web Components (@zelviora/chart)
import '@zelviora/chart';
```

## Key Features

- **Tree-shaken ECharts 6 Core**: Automatically registers only the required ECharts chart module and components.
- **Design System Token Synchronization**: Reads `--z-chart-series-1..8`, `--z-chart-grid-color`, and `--z-chart-axis-color`, reacting automatically to Light/Dark mode and theme preset changes.
- **Built-in Accessibility (WCAG AAA)**: Renders a semantic `<figure>` with `<figcaption>`, interactive `aria-pressed` legend toggles, and a synchronized `<table>` for screen readers.
- **Escape Hatch (`option`)**: Deep-merges any raw ECharts `option` object on top of the declarative props.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZThemeRiverChart } from '@zelviora/angular-chart';
import { riverItems, riverSeries } from '../data';

@Component({
  selector: 'demo-theme-river-chart-basic',
  imports: [ZThemeRiverChart],
  template: `
    <z-theme-river-chart
      heading="Documentation Search Topic Streamgraph"
      description="Evolution of search interest across Components, Tokens, and Charts over four weeks."
      [riverData]="riverData" [series]="series"
    ></z-theme-river-chart>
  `,
})
export class ThemeRiverChartBasic {
  readonly riverData = riverItems;
  readonly series = riverSeries;
}

```

### Case: controlled

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/angular';
import { ZThemeRiverChart, type ChartPointSelectDetail, type ChartSeriesToggleDetail } from '@zelviora/angular-chart';
import { riverItems, riverSeries } from '../data';

@Component({
  selector: 'demo-theme-river-chart-controlled',
  imports: [ZStack, ZButton, ZBadge, ZText, ZThemeRiverChart],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <z-button size="sm" variant="outline" (click)="hidden = []">
          Show All Series
        </z-button>
        <z-badge tone="primary" variant="soft">{{ selected }}</z-badge>
        <z-text variant="muted" size="sm">
          Hidden: {{ hidden.length ? hidden.join(', ') : 'none' }}
        </z-text>
      </z-stack>
      <z-theme-river-chart
        heading="Documentation Search Topic Streamgraph (Interactive)"
        description="Evolution of search interest across Components, Tokens, and Charts over four weeks."
        [riverData]="riverData" [series]="series"
        [selectable]="true"
        [hiddenSeries]="hidden"
        (zSeriesToggle)="onToggle($event)"
        (zPointSelect)="onSelect($event)"
      ></z-theme-river-chart>
    </z-stack>
  `,
})
export class ThemeRiverChartControlled {
  readonly riverData = riverItems;
  readonly series = riverSeries;
  hidden: string[] = [];
  selected = 'Click any chart element to inspect';

  onToggle(e: CustomEvent<ChartSeriesToggleDetail>) {
    this.hidden = e.detail.hiddenSeries;
  }

  onSelect(e: CustomEvent<ChartPointSelectDetail>) {
    this.selected = `Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`;
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZThemeRiverChart } from '@zelviora/angular-chart';
import { riverItems, riverSeries } from '../data';

@Component({
  selector: 'demo-theme-river-chart-customization',
  imports: [ZThemeRiverChart],
  template: `
    <z-theme-river-chart
      class="demo-chart-brand"
      description="Evolution of search interest across Components, Tokens, and Charts over four weeks."
      [valueFormat]="{ maximumFractionDigits: 1 }"
      [riverData]="riverData" [series]="series" renderer="canvas"
    >
      <span slot="heading">Documentation Search Topic Streamgraph — Custom Theme Tokens &amp; Canvas</span>
    </z-theme-river-chart>
  `,
})
export class ThemeRiverChartCustomization {
  readonly riverData = riverItems;
  readonly series = riverSeries;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZThemeRiverChart } from '@zelviora/angular-chart';
import { riverItems, riverSeries } from '../data';

@Component({
  selector: 'demo-theme-river-chart-states',
  imports: [ZStack, ZThemeRiverChart],
  template: `
    <z-stack gap="lg">
      <z-theme-river-chart
        heading="Loading State (aria-busy)"
        [loading]="true"
        [riverData]="riverData" [series]="series"
      ></z-theme-river-chart>
      <z-theme-river-chart
        heading="Empty State"
        [riverData]="[]"
        [series]="series"
      ></z-theme-river-chart>
      <z-theme-river-chart
        heading="Expanded Accessible Data Table"
        description="Evolution of search interest across Components, Tokens, and Charts over four weeks."
        [showDataTable]="true"
        [riverData]="riverData" [series]="series"
      ></z-theme-river-chart>
    </z-stack>
  `,
})
export class ThemeRiverChartStates {
  readonly riverData = riverItems;
  readonly series = riverSeries;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZThemeRiverChart } from '@zelviora/angular-chart';
import { riverItems, riverSeries } from '../data';

@Component({
  selector: 'demo-theme-river-chart-variants',
  imports: [ZStack, ZThemeRiverChart],
  template: `
    <z-stack gap="lg">
      <z-theme-river-chart
        heading="Labeled Stream Ribbons"
        description="Streamgraph with inline series labels vs clean unlabeled stream ribbons."
        [riverData]="riverData" [series]="series" [showLabel]="true"
      ></z-theme-river-chart>
      <z-theme-river-chart
        heading="Clean Streamgraph Ribbons"
        description="Streamgraph with inline series labels vs clean unlabeled stream ribbons."
        [riverData]="riverData" [series]="series" [showLabel]="false"
      ></z-theme-river-chart>
    </z-stack>
  `,
})
export class ThemeRiverChartVariants {
  readonly riverData = riverItems;
  readonly series = riverSeries;
}

```


================================================================================
# COMPONENT: TIME-PICKER
================================================================================

## Documentation

# time-picker — Angular

Processed requirements of [`<z-time-picker>`](../../../../../requirements/04-components/form/time-picker.md) for Angular
(`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SelectValueAccessor, ZTimePicker } from '@zelviora/angular';

@Component({
  selector: 'app-demo',
  imports: [FormsModule, SelectValueAccessor, ZTimePicker],
  template: `<z-time-picker name="start" label="Start time" [(ngModel)]="time"></z-time-picker>`,
})
export class Demo {
  time: string | null = null;
}
```

## Binding

| Component | Value accessor | Model | Event | Detail |
|---|---|---|---|---|
| `ZTimePicker` | `SelectValueAccessor` (spec §12: `select`) | `[(ngModel)]` / `formControl` (`string \| null`) | `(zChange)` | `{ value }` |
| `ZTimePicker` | — | `[open]` (no two-way binding, D-031) | `(zOpenChange)` | `{ open, reason }` |

Other events: `(zBeforeOpen)` / `(zBeforeClose)` (cancelable), `(zClear)`, `(zAfterOpen)`, `(zAfterClose)`. There is no `zInput`: a half-typed time is not a value.
Function props (`isTimeUnavailable`, `now`) are passed as properties.

The accessor applies `ValidityValidator`: `required`, `min`/`max` (`rangeUnderflow`/`rangeOverflow`), a value off the step (`stepMismatch`), a half-typed time (`badInput`) and blocked times (`customError`) reach the Angular control errors.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `time-picker-default.ts` | D-1 Default (fixed "Now"), D-15 Keyboard-only (hint) |
| `variants` | `time-picker-variants.ts` | D-3 Variants (`outline`/`filled`), D-5 Sizes |
| `states` | `time-picker-states.ts` | D-6 States, D-7 Disabled, D-14 Long content |
| `validation` | `time-picker-validation.ts` | D-8 Error (required, outside min/max, off-step) |
| `controlled` | `time-picker-controlled.ts` | D-9 Controlled |
| `form` | `time-picker-form.ts` | D-10 In form, D-17 Composition (field) |
| `i18n` | `time-picker-i18n.ts` | D-19 i18n (vi 24 h, en-US 12 h), D-21 h12, D-11 RTL (ar-EG) |
| `customization` | `time-picker-customization.ts` | D-18 Customization (`::part(option-selected)`) |
| `seconds` | `time-picker-seconds.ts` | D-22 `granularity="second"` (and `hour`) |
| `steps` | `time-picker-steps.ts` | D-23 `minuteStep=15` + office hours min/max |
| `unavailable` | `time-picker-unavailable.ts` | D-24 Unavailable times |

D-2 Playground, D-12 Dark, D-13 Brand showcase and D-16 Density come from the docs site switchers; D-4 Tones and D-20 Empty / loading do not apply.

The `customization` demo uses the `demo-time-picker-brand` rule of `demo.css` (same rule as the React README).

## Differences

- The value is always 24 h (`HH:mm`), whatever the hour cycle shown.
- The popup columns apply each choice at once (no OK button); Escape closes without undoing.
- Bind boolean and number inputs with `[prop]="…"` (`[required]="true"`).
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZStack, ZTimePicker } from '@zelviora/angular';

/** The app owns `value`: buttons set it from code (no event), the log lists user changes and popup changes. */
@Component({
  selector: 'demo-time-picker-controlled',
  imports: [ZButton, ZStack, ZTimePicker],
  template: `
    <z-stack class="demo-narrow">
      <z-time-picker
        label="Reminder time"
       
        [now]="now"
        [value]="value()"
        (zChange)="value.set($event.detail.value); add('zChange ' + $event.detail.value)"
        (zOpenChange)="add('zOpenChange ' + $event.detail.open + ' (' + $event.detail.reason + ')')"
      ></z-time-picker>
      <z-stack orientation="horizontal" gap="sm" [wrap]="true">
        <z-button variant="outline" tone="neutral" (click)="value.set('17:30')">Set 17:30</z-button>
        <z-button variant="outline" tone="neutral" (click)="value.set(null)">Clear</z-button>
      </z-stack>
      <span>Value: {{ value() ?? 'null' }}</span>
      <output>{{ log().join(' · ') }}</output>
    </z-stack>
  `,
})
export class TimePickerControlled {
  readonly value = signal<string | null>('09:00');
  readonly log = signal<string[]>([]);
  readonly now = () => '09:41';

  add(line: string) {
    this.log.update((l) => [line, ...l].slice(0, 5));
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZTimePicker } from '@zelviora/angular';

/** Component tokens and the `option-selected` part: see the `demo-time-picker-brand` rule in README. */
@Component({
  selector: 'demo-time-picker-customization',
  imports: [ZTimePicker],
  template: `
    <z-time-picker class="demo-narrow demo-time-picker-brand" label="Appointment time" value="10:30"></z-time-picker>
  `,
})
export class TimePickerCustomization {}

```

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SelectValueAccessor, ZStack, ZTimePicker } from '@zelviora/angular';

/**
 * Type hours and minutes, or press Alt+ArrowDown to pick in the columns; "Now" is fixed so the demo never changes.
 * `[(ngModel)]` through SelectValueAccessor (model event `zChange`, `HH:mm` or null).
 */
@Component({
  selector: 'demo-time-picker-default',
  imports: [FormsModule, SelectValueAccessor, ZStack, ZTimePicker],
  template: `
    <z-stack class="demo-narrow">
      <z-time-picker label="Appointment time" hint="Type hours:minutes or press Alt+↓ to open the list" [clearable]="true" [now]="now" [(ngModel)]="value"></z-time-picker>
      <span>Value: {{ value ?? 'null' }}</span>
    </z-stack>
  `,
})
export class TimePickerDefault {
  value: string | null = null;
  readonly now = () => '09:41';
}

```

### Case: form

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZField, ZStack, ZTimePicker } from '@zelviora/angular';

/**
 * Native form: the value is submitted as HH:mm (FormData), required inside a field, reset restores defaults.
 * FormsModule is not imported, so the form stays native and the element submits its own FormData entry.
 */
@Component({
  selector: 'demo-time-picker-form',
  imports: [ZButton, ZField, ZStack, ZTimePicker],
  template: `
    <form class="demo-narrow" (submit)="submit($event)">
      <z-stack>
        <z-field label="Delivery time" hint="From 08:00 to 20:00" [required]="true">
          <z-time-picker name="delivery" min="08:00" max="20:00" [required]="true"></z-time-picker>
        </z-field>
        <z-time-picker name="reminder" label="Reminder time" value="07:30"></z-time-picker>
        <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
          <z-button type="submit">Submit</z-button>
          <z-button type="reset" variant="outline" tone="neutral">Reset</z-button>
        </z-stack>
        @if (sent()) {
          <output>{{ sent() }}</output>
        }
      </z-stack>
    </form>
  `,
})
export class TimePickerForm {
  readonly sent = signal('');

  submit(e: Event) {
    e.preventDefault();
    this.sent.set(JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]));
  }
}

```

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGrid, ZTimePicker } from '@zelviora/angular';

/** The hour cycle follows the locale (vi 24 h, en-US 12 h with AM/PM); the value stays 24 h. Arabic in RTL. */
@Component({
  selector: 'demo-time-picker-i18n',
  imports: [ZGrid, ZTimePicker],
  template: `
    <z-grid columns="1 sm:2" gap="md">
      <z-time-picker label="Tiếng Việt (24 giờ)" locale="vi" value="14:30"></z-time-picker>
      <z-time-picker label="English US (12 hours)" locale="en-US" value="14:30"></z-time-picker>
      <z-time-picker label="Forced 12 hours in Vietnamese" locale="vi" hourCycle="h12" value="14:30"></z-time-picker>
      <div dir="rtl" lang="ar-EG">
        <z-time-picker label="العربية" locale="ar-EG" value="14:30"></z-time-picker>
      </div>
    </z-grid>
  `,
})
export class TimePickerI18n {}

```

### Case: seconds

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGrid, ZTimePicker } from '@zelviora/angular';

/** Granularity: `second` adds a seconds segment and column (HH:mm:ss); `hour` keeps minutes at 00. */
@Component({
  selector: 'demo-time-picker-seconds',
  imports: [ZGrid, ZTimePicker],
  template: `
    <z-grid columns="1 sm:2" gap="md">
      <z-time-picker label="Time (seconds)" granularity="second" [secondStep]="5" value="08:15:30"></z-time-picker>
      <z-time-picker label="Hour slot" granularity="hour" value="08:00"></z-time-picker>
    </z-grid>
  `,
})
export class TimePickerSeconds {}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGrid, ZTimePicker } from '@zelviora/angular';

/** Empty, filled, disabled, readonly, invalid and display statuses; a long label in a narrow column wraps. */
@Component({
  selector: 'demo-time-picker-states',
  imports: [ZGrid, ZTimePicker],
  template: `
    <z-grid columns="1 sm:2" gap="md">
      <z-time-picker label="Empty"></z-time-picker>
      <z-time-picker label="With value" value="14:15"></z-time-picker>
      <z-time-picker label="Disabled" value="14:15" [disabled]="true"></z-time-picker>
      <z-time-picker label="Readonly" value="14:15" [readonly]="true"></z-time-picker>
      <z-time-picker label="Invalid" value="14:15" [invalid]="true"></z-time-picker>
      <z-time-picker label="Warning" value="14:15" status="warning"></z-time-picker>
      <z-time-picker label="Success" value="14:15" status="success"></z-time-picker>
      <z-time-picker
        class="demo-narrow"
        label="Expected start time of the afternoon shift at the downtown branch"
       
        value="13:30"
      ></z-time-picker>
    </z-grid>
  `,
})
export class TimePickerStates {}

```

### Case: steps

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZTimePicker } from '@zelviora/angular';

/** Office hours only (08:00–17:30) in 15-minute steps; PageUp/PageDown jump further, Home/End go to the limits. */
@Component({
  selector: 'demo-time-picker-steps',
  imports: [ZTimePicker],
  template: `
    <z-time-picker class="demo-narrow" label="Working hours" min="08:00" max="17:30" [minuteStep]="15" hint="08:00–17:30, 15-minute steps"></z-time-picker>
  `,
})
export class TimePickerSteps {}

```

### Case: unavailable

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZTimePicker } from '@zelviora/angular';

/** The lunch break (12:00–12:59) cannot be picked; typing it is an error. The footer slot adds a note. */
@Component({
  selector: 'demo-time-picker-unavailable',
  imports: [ZTimePicker],
  template: `
    <z-time-picker class="demo-narrow" label="Appointment time" [minuteStep]="30" [isTimeUnavailable]="isLunch">
      <span slot="footer">Lunch break 12:00–13:00</span>
    </z-time-picker>
  `,
})
export class TimePickerUnavailable {
  readonly isLunch = (time: string) => time.startsWith('12:');
}

```

### Case: validation

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZStack, ZTimePicker } from '@zelviora/angular';

/** Required, a range (min / max) with a localized message, and a value off the minute step. */
@Component({
  selector: 'demo-time-picker-validation',
  imports: [ZButton, ZStack, ZTimePicker],
  template: `
    <form class="demo-narrow" (submit)="$event.preventDefault()">
      <z-stack>
        <z-time-picker name="start" label="Start time" [required]="true"></z-time-picker>
        <z-time-picker name="office" label="Office hours (08:00–17:00)" min="08:00" max="17:00" value="18:30"></z-time-picker>
        <z-time-picker name="slot" label="15-minute step" [minuteStep]="15" value="10:10" hint="10:10 is not on a 15-minute step"></z-time-picker>
        <z-button type="submit">Submit</z-button>
      </z-stack>
    </form>
  `,
})
export class TimePickerValidation {}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGrid, ZTimePicker } from '@zelviora/angular';

/** Outline and filled field in every size. */
@Component({
  selector: 'demo-time-picker-variants',
  imports: [ZGrid, ZTimePicker],
  template: `
    <z-grid columns="1 sm:3" gap="md">
      <z-time-picker label="Small" size="sm" value="08:30"></z-time-picker>
      <z-time-picker label="Medium" size="md" value="08:30"></z-time-picker>
      <z-time-picker label="Large" size="lg" value="08:30"></z-time-picker>
      <z-time-picker label="Small filled" size="sm" variant="filled"></z-time-picker>
      <z-time-picker label="Medium filled" size="md" variant="filled"></z-time-picker>
      <z-time-picker label="Large filled" size="lg" variant="filled"></z-time-picker>
    </z-grid>
  `,
})
export class TimePickerVariants {}

```


================================================================================
# COMPONENT: TIMELINE
================================================================================

## Documentation

# timeline — Angular

Processed requirements of [`<z-timeline>`](../../../../../requirements/04-components/data-display/timeline.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-timeline label="Order history">
  <z-timeline-item heading="Delivered" time="2026-10-02T09:30:00+07:00" tone="success">Hanoi</z-timeline-item>
</z-timeline>
```

## Binding

No model event. `time` must be ISO 8601 with a time zone (`Z` or `+07:00`). Search keyword: "Timeline", "activity log" (antd `Timeline`).

## Events

None.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `timeline-basic.ts` | D-1 Default, D-19 i18n |
| `layouts` | `timeline-layouts.ts` | D-3 Variants (layout, opposite slot) |
| `horizontal` | `timeline-horizontal.ts` | D-3 Variants (orientation), D-11 RTL |
| `tones` | `timeline-tones.ts` | D-4 Tones, D-8 Error |
| `pending` | `timeline-pending.ts` | D-6 States, D-20 Empty / loading, D-19 i18n (relative) |
| `sizes` | `timeline-sizes.ts` | D-5 Sizes, D-16 Density |
| `custom` | `timeline-custom.ts` | D-17 Composition, D-15 Keyboard-only, D-18 Customization |


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZTimeline, ZTimelineItem } from '@zelviora/angular';

@Component({
  selector: 'demo-timeline-basic',
  imports: [ZTimeline, ZTimelineItem],
  template: `
    <z-timeline label="Order history">
      <z-timeline-item heading="Order placed" time="2026-10-01T08:15:00+07:00">Paid by card.</z-timeline-item>
      <z-timeline-item heading="Packed" time="2026-10-01T14:40:00+07:00">Warehouse Hanoi.</z-timeline-item>
      <z-timeline-item heading="Shipped" time="2026-10-02T07:05:00+07:00">Carrier: GHN, tracking 8234 1102.</z-timeline-item>
      <z-timeline-item heading="Delivered" time="2026-10-02T16:30:00+07:00" tone="success">Received by the customer.</z-timeline-item>
    </z-timeline>
  `,
})
export class TimelineBasic {}

```

### Case: custom

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCard, ZLink, ZTimeline, ZTimelineItem } from '@zelviora/angular';

@Component({
  selector: 'demo-timeline-custom',
  imports: [ZCard, ZLink, ZTimeline, ZTimelineItem],
  template: `
    <z-card heading="Activity">
      <z-timeline label="Activity">
        <z-timeline-item heading="Anna commented" [headingLevel]="4" time="2026-10-05T09:12:00Z">
          <svg slot="dot" viewBox="0 0 16 16" width="16" height="16" fill="currentColor"><path d="M2 3h12v8H6l-4 3z" /></svg>
          “Looks good, ship it.” <z-link href="#comment-12">View comment</z-link>
        </z-timeline-item>
        <z-timeline-item heading="Ben merged the pull request" [headingLevel]="4" time="2026-10-05T10:40:00Z" tone="primary">
          <svg slot="dot" viewBox="0 0 16 16" width="16" height="16" fill="currentColor"><circle cx="4" cy="4" r="2" /><circle cx="4" cy="12" r="2" /><circle cx="12" cy="8" r="2" /><path d="M4 6v4M6 4h2a4 4 0 0 1 4 4" stroke="currentColor" fill="none" /></svg>
          Branch p3/86 into main.
        </z-timeline-item>
      </z-timeline>
    </z-card>
  `,
})
export class TimelineCustom {}

```

### Case: horizontal

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZTimeline, ZTimelineItem } from '@zelviora/angular';

@Component({
  selector: 'demo-timeline-horizontal',
  imports: [ZTimeline, ZTimelineItem],
  template: `
    <z-timeline label="Shipment" orientation="horizontal">
      @for (heading of steps; track heading; let i = $index) {
        <z-timeline-item [heading]="heading" [tone]="i < 3 ? 'success' : 'neutral'">
          <span slot="opposite">Day {{ i + 1 }}</span>
        </z-timeline-item>
      }
    </z-timeline>
  `,
})
export class TimelineHorizontal {
  readonly steps = ['Ordered', 'Confirmed', 'Packed', 'Shipped', 'Out for delivery', 'Delivered'];
}

```

### Case: layouts

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGrid, ZTimeline, ZTimelineItem } from '@zelviora/angular';

@Component({
  selector: 'demo-timeline-layouts',
  imports: [ZGrid, ZTimeline, ZTimelineItem],
  template: `
    <z-grid columns="1 md:3" gap="lg">
      @for (layout of layouts; track layout) {
        <z-timeline [label]="'Layout ' + layout" [layout]="layout">
          <z-timeline-item heading="Kick-off"><span slot="opposite">Mon</span>Scope agreed.</z-timeline-item>
          <z-timeline-item heading="Design"><span slot="opposite">Wed</span>Wireframes approved.</z-timeline-item>
          <z-timeline-item heading="Build"><span slot="opposite">Fri</span>First release.</z-timeline-item>
        </z-timeline>
      }
    </z-grid>
  `,
})
export class TimelineLayouts {
  readonly layouts = ['start', 'alternate', 'end'] as const;
}

```

### Case: pending

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZTimeline, ZTimelineItem } from '@zelviora/angular';

const hoursAgo = (h: number) => new Date(Date.now() - h * 3600_000).toISOString();

@Component({
  selector: 'demo-timeline-pending',
  imports: [ZTimeline, ZTimelineItem],
  template: `
    <z-timeline label="Import" [pending]="true" pendingLabel="Importing contacts…">
      <z-timeline-item heading="File uploaded" [time]="uploaded" timeFormat="relative" tone="success"></z-timeline-item>
      <z-timeline-item heading="Columns mapped" [time]="mapped" timeFormat="relative" tone="success"></z-timeline-item>
    </z-timeline>
  `,
})
export class TimelinePending {
  readonly uploaded = hoursAgo(3);
  readonly mapped = hoursAgo(1);
}

```

### Case: sizes

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGrid, ZTimeline, ZTimelineItem } from '@zelviora/angular';

@Component({
  selector: 'demo-timeline-sizes',
  imports: [ZGrid, ZTimeline, ZTimelineItem],
  template: `
    <z-grid columns="1 md:3" gap="lg">
      @for (size of sizes; track size) {
        <z-timeline [label]="'Size ' + size" [size]="size">
          <z-timeline-item heading="Created" time="2026-09-30" timeFormat="date"></z-timeline-item>
          <z-timeline-item heading="Updated" time="2026-10-04" timeFormat="date"></z-timeline-item>
        </z-timeline>
      }
    </z-grid>
  `,
})
export class TimelineSizes {
  readonly sizes = ['sm', 'md', 'lg'] as const;
}

```

### Case: tones

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZTimeline, ZTimelineItem } from '@zelviora/angular';

@Component({
  selector: 'demo-timeline-tones',
  imports: [ZTimeline, ZTimelineItem],
  template: `
    <z-timeline label="Deploy log">
      <z-timeline-item heading="Build started" tone="info">Commit 3d132c5.</z-timeline-item>
      <z-timeline-item heading="Tests passed" tone="success">812 tests.</z-timeline-item>
      <z-timeline-item heading="Warning: slow step" tone="warning">Docs build took 2 minutes.</z-timeline-item>
      <z-timeline-item heading="Error: deploy failed" tone="destructive">The server rejected the upload (HTTP 503).</z-timeline-item>
    </z-timeline>
  `,
})
export class TimelineTones {}

```


================================================================================
# COMPONENT: TOAST
================================================================================

## Documentation

# toast — Angular

Processed requirements of [`<z-toast>` / `<z-toast-region>`](../../../../../requirements/04-components/overlay-feedback/toast.md)
for Angular (`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component } from '@angular/core';
import { ZToastRegion, toast } from '@zelviora/angular';

// Once, in the root component template.
@Component({ selector: 'app-root', imports: [ZToastRegion], template: `<z-toast-region></z-toast-region> …` })
export class App {
  save() {
    toast('Saved');
    toast.success('Uploaded');
    toast({ variant: 'notification', heading: 'Deleted', action: { id: 'undo', label: 'Undo', onAction: () => this.undo() } });
  }
}
```

`toast` is re-exported by `@zelviora/angular` from `@zelviora/core`. While a modal dialog is open, toasts created by `toast()`
move into the dialog so their actions stay usable. Update component state from `onAction` callbacks with signals so
change detection picks it up (also zoneless).

## Binding

Declared `<z-toast>` elements: `[open]` + `(zOpenChange)` (no `[(open)]`: the output is `zOpenChange`, not `openChange`).

## Events

On `z-toast`: `(zBeforeClose)` (cancelable), `(zOpenChange)`, `(zAfterClose)`, `(zAction)` (`{ action }`).

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `toast-default.ts` | D-1 Default, D-4 Tones |
| `action` | `toast-action.ts` | D-3 Variants (notification), D-15 Keyboard-only |
| `promise` | `toast-promise.ts` | D-20 Loading (`toast.promise`) |

## Differences

- Each demo uses its own named region so the demos of a page do not share one.
- Boolean props are bound with `[prop]="true"` (`[showProgress]="true"`).
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: action

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZStack, ZToastRegion, toast } from '@zelviora/angular';

/** Notification with an action: it does not close by itself (MO-4); F8 moves focus to it. */
@Component({
  selector: 'demo-toast-action',
  imports: [ZButton, ZStack, ZToastRegion],
  template: `
    <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
      <z-toast-region name="demo-action" placement="top-end"></z-toast-region>
      <span>Files: {{ files() }}</span>
      <z-button variant="outline" tone="destructive" [disabled]="files() === 0" (click)="deleteFile()">Delete a file</z-button>
    </z-stack>
  `,
})
export class ToastAction {
  readonly files = signal(3);

  deleteFile() {
    this.files.update((n) => n - 1);
    toast({
      region: 'demo-action',
      variant: 'notification',
      heading: 'File deleted',
      description: 'report.pdf was moved to the trash.',
      action: { id: 'undo', label: 'Undo', onAction: () => this.files.update((n) => n + 1) },
    });
  }
}

```

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZStack, ZToastRegion, toast } from '@zelviora/angular';

/** Put one region in the app layout; call toast() from anywhere. */
@Component({
  selector: 'demo-toast-default',
  imports: [ZButton, ZStack, ZToastRegion],
  template: `
    <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
      <z-toast-region name="demo-default"></z-toast-region>
      <z-button (click)="save()">Save</z-button>
      <z-button variant="outline" tone="success" (click)="upload()">Upload</z-button>
      <z-button variant="outline" tone="destructive" (click)="fail()">Fail</z-button>
    </z-stack>
  `,
})
export class ToastDefault {
  save() {
    toast('Changes saved', { region: 'demo-default' });
  }

  upload() {
    toast.success('Uploaded 3 files', { region: 'demo-default' });
  }

  fail() {
    toast.error('Could not reach the server', { region: 'demo-default' });
  }
}

```

### Case: promise

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZStack, ZToastRegion, toast } from '@zelviora/angular';

const fakeSave = () => new Promise<number>((resolve) => setTimeout(() => resolve(12), 1500));

/** A loading toast that turns into success or error when the promise settles. */
@Component({
  selector: 'demo-toast-promise',
  imports: [ZButton, ZStack, ZToastRegion],
  template: `
    <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
      <z-toast-region name="demo-promise" placement="bottom" [showProgress]="true"></z-toast-region>
      <z-button (click)="saveRecords()">Save records</z-button>
    </z-stack>
  `,
})
export class ToastPromise {
  saveRecords() {
    void toast.promise(
      fakeSave(),
      { loading: 'Saving 12 records…', success: (n) => `Saved ${n} records`, error: 'Saving failed' },
      { region: 'demo-promise' },
    );
  }
}

```


================================================================================
# COMPONENT: TOGGLE
================================================================================

## Documentation

# toggle — Angular

Processed requirements of [`<z-toggle>`](../../../../../requirements/04-components/base/toggle.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-toggle [pressed]="pinned()" (zChange)="pinned.set($event.detail.pressed)">Pin</z-toggle>
```

## Binding

Not a form control: no value accessor (the generated boolean accessor writes `checked`). Bind `[pressed]` and `(zChange)`.

## Events

`zChange` `{ pressed }` after a user toggle; setting `pressed` from code emits nothing.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `toggle-basic.ts` | D-1 Default |
| `variants` | `toggle-variants.ts` | D-3 Variants, D-5 Sizes, D-6 States, D-7 Disabled |
| `controlled` | `toggle-controlled.ts` | D-9 Controlled |
| `toolbar` | `toggle-toolbar.ts` | D-17 Composition |


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZToggle } from '@zelviora/angular';

@Component({
  selector: 'demo-toggle-basic',
  imports: [ZToggle],
  template: `
    <z-toggle [pressed]="true">Pin</z-toggle>
  `,
})
export class ToggleBasic {}

```

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZStack, ZToggle } from '@zelviora/angular';

@Component({
  selector: 'demo-toggle-controlled',
  imports: [ZButton, ZStack, ZToggle],
  template: `
    <z-stack gap="sm">
      <z-stack orientation="horizontal" align-items="center" gap="sm" [wrap]="true">
        <z-toggle variant="outline" [pressed]="grid()" (zChange)="onChange($event.detail.pressed)">Grid view</z-toggle>
        <z-button variant="ghost" tone="neutral" (click)="grid.set(false)">Reset from code</z-button>
      </z-stack>
      <small>View: {{ grid() ? 'grid' : 'list' }} · {{ log().join(' · ') || 'no event yet' }}</small>
    </z-stack>
  `,
})
export class ToggleControlled {
  readonly grid = signal(false);
  readonly log = signal<string[]>([]);

  onChange(pressed: boolean) {
    this.grid.set(pressed);
    this.log.update((l) => [`zChange pressed=${pressed}`, ...l].slice(0, 3));
  }
}

```

### Case: toolbar

#### Angular
```typescript
import { Component, computed, signal } from '@angular/core';
import { ZButtonGroup, ZStack, ZText, ZToggle } from '@zelviora/angular';

@Component({
  selector: 'demo-toggle-toolbar',
  imports: [ZButtonGroup, ZStack, ZText, ZToggle],
  template: `
    <z-stack gap="sm">
      <z-button-group label="Text format" [detached]="true">
        <z-toggle size="sm" label="Bold" [pressed]="format().bold" (zChange)="set('bold', $event.detail.pressed)">B</z-toggle>
        <z-toggle size="sm" label="Italic" [pressed]="format().italic" (zChange)="set('italic', $event.detail.pressed)">I</z-toggle>
        <z-toggle size="sm" label="Underline" [pressed]="format().underline" (zChange)="set('underline', $event.detail.pressed)">U</z-toggle>
      </z-button-group>
      <z-text variant="muted" size="sm">Active: {{ active() || 'none' }}</z-text>
    </z-stack>
  `,
})
export class ToggleToolbar {
  readonly format = signal({ bold: true, italic: false, underline: false });
  readonly active = computed(() => Object.entries(this.format()).filter(([, on]) => on).map(([k]) => k).join(', '));

  set(key: 'bold' | 'italic' | 'underline', pressed: boolean) {
    this.format.update((f) => ({ ...f, [key]: pressed }));
  }
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZGrid, ZToggle } from '@zelviora/angular';

@Component({
  selector: 'demo-toggle-variants',
  imports: [ZGrid, ZToggle],
  template: `
    <z-grid columns="1 sm:3" gap="md">
      @for (variant of variants; track variant) {
        <z-toggle [variant]="variant">{{ variant }} off</z-toggle>
        <z-toggle [variant]="variant" [pressed]="true">{{ variant }} on</z-toggle>
        <z-toggle [variant]="variant" [pressed]="true" [disabled]="true">{{ variant }} disabled</z-toggle>
      }
      @for (size of sizes; track size) {
        <z-toggle [size]="size" variant="outline">Size {{ size }}</z-toggle>
      }
    </z-grid>
  `,
})
export class ToggleVariants {
  readonly variants = ['ghost', 'outline'] as const;
  readonly sizes = ['sm', 'md', 'lg'] as const;
}

```


================================================================================
# COMPONENT: TOGGLE-GROUP
================================================================================

## Documentation

# toggle-group — Angular

Processed requirements of `z-toggle-group` and `z-toggle-group-item` ([spec](../../../../../requirements/04-components/base/toggle-group.md)) for Angular
(`@zelviora/angular`).

## Binding and events

| Input | Output | Detail |
|---|---|---|
| `[value]` | `(zChange)` | `{ value }` |

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `toggle-group-default.ts` | D-1 Default, D-15 Keyboard-only, D-20 Empty |
| `multiple` | `toggle-group-multiple.ts` | D-17 Composition, D-9 Controlled, D-3 Variants (outline) |
| `vertical` | `toggle-group-vertical.ts` | D-21 Vertical, D-22 disallowEmpty, D-5 Sizes, D-7 Disabled |

## Differences

- Bind booleans with `[prop]="true"`; plain attributes are strings.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZToggleGroup, ZToggleGroupItem } from '@zelviora/angular';

@Component({
  selector: 'demo-toggle-group-default',
  imports: [ZToggleGroup, ZToggleGroupItem],
  template: `
    <z-toggle-group label="Text alignment" defaultValue="center">
      <z-toggle-group-item value="left">Left</z-toggle-group-item>
      <z-toggle-group-item value="center">Center</z-toggle-group-item>
      <z-toggle-group-item value="right">Right</z-toggle-group-item>
    </z-toggle-group>
  `,
})
export class ToggleGroupDefault {}

```

### Case: multiple

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZStack, ZToggleGroup, ZToggleGroupItem } from '@zelviora/angular';
import type { ZToggleGroupChangeDetail } from '@zelviora/core';

@Component({
  selector: 'demo-toggle-group-multiple',
  imports: [ZStack, ZToggleGroup, ZToggleGroupItem],
  template: `
    <z-stack gap="sm">
      <z-toggle-group [multiple]="true" variant="outline" label="Formatting" [value]="value()" (zChange)="onChange($event.detail)">
        <z-toggle-group-item value="bold" label="Bold"><strong slot="icon-start" aria-hidden="true">B</strong></z-toggle-group-item>
        <z-toggle-group-item value="italic" label="Italic"><em slot="icon-start" aria-hidden="true">I</em></z-toggle-group-item>
        <z-toggle-group-item value="underline" label="Underline"><u slot="icon-start" aria-hidden="true">U</u></z-toggle-group-item>
      </z-toggle-group>
      <p>Pressed: {{ value().join(', ') || 'none' }}</p>
    </z-stack>
  `,
})
export class ToggleGroupMultiple {
  readonly value = signal<string[]>(['bold']);

  onChange(detail: ZToggleGroupChangeDetail) {
    this.value.set(detail.value as string[]);
  }
}

```

### Case: vertical

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZToggleGroup, ZToggleGroupItem } from '@zelviora/angular';

@Component({
  selector: 'demo-toggle-group-vertical',
  imports: [ZToggleGroup, ZToggleGroupItem],
  template: `
    <z-toggle-group label="View density" orientation="vertical" size="sm" [disallowEmpty]="true" defaultValue="comfortable">
      <z-toggle-group-item value="compact">Compact</z-toggle-group-item>
      <z-toggle-group-item value="comfortable">Comfortable</z-toggle-group-item>
      <z-toggle-group-item value="spacious" [disabled]="true">Spacious</z-toggle-group-item>
    </z-toggle-group>
  `,
})
export class ToggleGroupVertical {}

```


================================================================================
# COMPONENT: TOOLTIP
================================================================================

## Documentation

# tooltip — Angular

Processed requirements of [`<z-tooltip>`](../../../../../requirements/04-components/overlay-feedback/tooltip.md) for Angular
(`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component } from '@angular/core';
import { ZButton, ZTooltip } from '@zelviora/angular';

@Component({
  selector: 'app-save',
  imports: [ZButton, ZTooltip],
  template: `
    <z-tooltip content="Saves a draft">
      <z-button>Save</z-button>
    </z-tooltip>
  `,
})
export class Save {}
```

The trigger is the single focusable child. Its text is also set on the trigger (`aria-description`, or `aria-label`
with `kind="label"`), so screen readers read it whether the tooltip is shown or not.

## Binding

`[open]` + `(zOpenChange)` (rarely needed).

## Events

`(zOpenChange)` (`{ open, reason: 'hover' | 'focus' | 'focus-out' | 'escape' | 'pointer' }`).

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `tooltip-default.ts` | D-1 Default |
| `label` | `tooltip-label.ts` | D-3 Variants (kind label), D-15 Keyboard-only |

## Differences

- Touch devices show no tooltip: never put required information only in a tooltip.
- Icons are registered once at module level with `registerIcons` from `@zelviora/icons`, as in the other frameworks.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZTooltip } from '@zelviora/angular';

@Component({
  selector: 'demo-tooltip-default',
  imports: [ZButton, ZTooltip],
  template: `
    <z-tooltip content="Saves a draft you can finish later">
      <z-button variant="outline" tone="neutral">Save draft</z-button>
    </z-tooltip>
  `,
})
export class TooltipDefault {}

```

### Case: label

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZIcon, ZStack, ZTooltip } from '@zelviora/angular';

/** Icon-only buttons get their accessible name from the tooltip (kind="label"). */
@Component({
  selector: 'demo-tooltip-label',
  imports: [ZButton, ZIcon, ZStack, ZTooltip],
  template: `
    <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
      <z-tooltip content="Next page" kind="label">
        <z-button variant="ghost" tone="neutral"><z-icon name="chevron_right" [flipRtl]="true"></z-icon></z-button>
      </z-tooltip>
      <z-tooltip content="Remove filter" kind="label" placement="bottom">
        <z-button variant="ghost" tone="neutral"><z-icon name="close"></z-icon></z-button>
      </z-tooltip>
    </z-stack>
  `,
})
export class TooltipLabel {}

```


================================================================================
# COMPONENT: TOUR
================================================================================

## Documentation

# tour — Angular

Processed requirements of [`<z-tour>`](../../../../../requirements/04-components/overlay-feedback/tour.md) for Angular (`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```html
<z-tour [open]="open()" (zOpenChange)="open.set($event.detail.open)">
  <z-tour-step target="#new" heading="Create a project">Start here.</z-tour-step>
  <z-tour-step heading="Done">A step without target is centered.</z-tour-step>
</z-tour>
```

## Binding

`[index]` + `(zChange)` (`$event.detail.index`); `[open]` + `(zOpenChange)`.

## Events

`(zChange)` (`{ value, index, reason }`), `(zBeforeClose)` (cancelable, `{ reason }`), `(zOpenChange)`, `(zFinish)`.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `tour-default.ts` | D-1 Default (3 steps), D-6 first/middle/last step |
| `controlled` | `tour-controlled.ts` | D-3 Variants (hide-mask), D-9 Controlled `index`, E-3 centered step |

## Differences

- `target` is a selector in the document (ids are unique per framework in these demos) or an element through the `steps` property (for targets inside other shadow roots).
- The data type of the `steps` property is `ZTourStepConfig` (spec name `ZTourStep` clashes with the step element type).


## Examples & Implementation

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZStack, ZText, ZTour, ZTourStep } from '@zelviora/angular';

/** Controlled `index`, an intro step without target (centered) and no mask. */
@Component({
  selector: 'demo-tour-controlled',
  imports: [ZButton, ZStack, ZText, ZTour, ZTourStep],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
        <z-button id="tour-angular-export" variant="outline" tone="neutral">Export</z-button>
        <z-text variant="muted">Step {{ index() + 1 }} of 2</z-text>
      </z-stack>
      <div>
        <z-button variant="outline" (click)="start()">What is new?</z-button>
      </div>
      <z-tour
        [hideMask]="true"
        [open]="open()"
        [index]="index()"
        (zOpenChange)="open.set($event.detail.open)"
        (zChange)="index.set($event.detail.index)"
      >
        <z-tour-step heading="Welcome to version 2">A short look at what changed.</z-tour-step>
        <z-tour-step target="#tour-angular-export" heading="Export" placement="right">Download any report as CSV or PDF.</z-tour-step>
      </z-tour>
    </z-stack>
  `,
})
export class TourControlled {
  readonly open = signal(false);
  readonly index = signal(0);

  start() {
    this.index.set(0);
    this.open.set(true);
  }
}

```

### Case: default

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZStack, ZTour, ZTourStep } from '@zelviora/angular';

@Component({
  selector: 'demo-tour-default',
  imports: [ZButton, ZStack, ZTour, ZTourStep],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" [wrap]="true" gap="sm">
        <z-button id="tour-angular-new">New project</z-button>
        <z-button id="tour-angular-search" variant="outline" tone="neutral">Search</z-button>
        <z-button id="tour-angular-settings" variant="ghost" tone="neutral">Settings</z-button>
      </z-stack>
      <div>
        <z-button variant="outline" (click)="open.set(true)">Start tour</z-button>
      </div>
      <z-tour [open]="open()" (zOpenChange)="open.set($event.detail.open)">
        <z-tour-step target="#tour-angular-new" heading="Create a project">Start here: a project groups your boards and files.</z-tour-step>
        <z-tour-step target="#tour-angular-search" heading="Find anything">Search projects, people and files.</z-tour-step>
        <z-tour-step target="#tour-angular-settings" heading="Make it yours" placement="right">Theme, language and notifications live here.</z-tour-step>
      </z-tour>
    </z-stack>
  `,
})
export class TourDefault {
  readonly open = signal(false);
}

```


================================================================================
# COMPONENT: TRANSFER
================================================================================

## Documentation

# transfer — Angular

Processed requirements of [`<z-transfer>`](../../../../../requirements/04-components/form/transfer.md) for Angular
(`@zelviora/angular`, standalone components, Angular >= 21).

## Usage

```ts
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SelectValueAccessor, ZTransfer } from '@zelviora/angular';

@Component({
  selector: 'app-roles',
  imports: [FormsModule, SelectValueAccessor, ZTransfer],
  template: `<z-transfer name="roles" label="Permissions" [items]="items" [(ngModel)]="roles"></z-transfer>`,
})
export class Roles { roles: string[] = []; items = [{ value: 'read', label: 'Xem' }]; }
```

## Binding

| Component | Value accessor | Model | Event | Detail |
|---|---|---|---|---|
| `ZTransfer` | `SelectValueAccessor` (array copied as is, like the range slider) | `[(ngModel)]` / `formControl` (`string[]`) | `(zChange)` | `{ value, direction, moved }` |

Other events: `(zSelectionChange)`, `(zSearch)`. Inputs: `[items]`, `[titles]`, `[filter]`, `[selectedSource]`,
`[selectedTarget]`.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `transfer-default.ts` | D-1 Default (10 permissions), D-15 Keyboard-only |
| `sizes` | `transfer-sizes.ts` | D-5 Sizes, D-16 Density |
| `states` | `transfer-states.ts` | D-6 States (ticked, disabled item, readonly, invalid), D-7 Disabled |
| `controlled` | `transfer-controlled.ts` | D-9 Controlled |
| `form` | `transfer-form.ts` | D-10 In form, D-8 Error (required), D-17 Composition (field) |
| `searchable` | `transfer-searchable.ts` | D-22 Searchable |
| `one-way` | `transfer-one-way.ts` | D-21 One way |
| `long` | `transfer-long.ts` | D-14 Long content (10 000 items, virtual, long label) |
| `customization` | `transfer-customization.ts` | D-18 Customization (tokens, `::part(option-selected)`) |
| `rtl` | `transfer-rtl.ts` | D-11 RTL, D-20 Empty |
| `i18n` | `transfer-i18n.ts` | D-19 i18n |

D-2 Playground, D-12 Dark and D-13 Brand showcase come from the docs site (theme and brand switchers); D-3 / D-4
Variants and Tones do not apply.

Customization rule used by the `customization` demo (`demo.css`):

```css
.demo-transfer-brand {
  --z-transfer-panel-height: 14rem;
  --z-transfer-panel-border-color: var(--z-color-primary);
  --z-transfer-option-bg-selected: var(--z-color-success-soft);
}
.demo-transfer-brand::part(option-selected) {
  font-weight: var(--z-font-weight-semibold);
}
```

## Differences

- Move buttons stay focusable when nothing can be moved (`aria-disabled`): focus stays on the button after a move.
- Enter in a list and a double click on an item move items too (one way: Enter submits the form from the target list).
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZStack, ZTransfer } from '@zelviora/angular';

const ROLES = [
  { value: 'read', label: 'View posts' },
  { value: 'write', label: 'Write posts' },
  { value: 'edit', label: 'Edit posts' },
  { value: 'publish', label: 'Publish posts' },
  { value: 'delete', label: 'Delete posts', description: 'Administrators only' },
  { value: 'comment', label: 'Comment' },
  { value: 'moderate', label: 'Moderate comments' },
  { value: 'users', label: 'Manage users' },
  { value: 'billing', label: 'Billing', disabled: true },
  { value: 'settings', label: 'System settings' },
];

/** The app owns `value`: buttons set it from code (no event); the log lists moves and ticks. */
@Component({
  selector: 'demo-transfer-controlled',
  imports: [ZButton, ZStack, ZTransfer],
  template: `
    <z-stack>
      <z-transfer
        label="Permissions"
        [items]="roles"
        [value]="value()"
        (zChange)="value.set($event.detail.value); add('zChange ' + $event.detail.direction + ' [' + $event.detail.moved.join(', ') + ']')"
        (zSelectionChange)="add('zSelectionChange [' + $event.detail.selectedSource.join(', ') + '] [' + $event.detail.selectedTarget.join(', ') + ']')"
      ></z-transfer>
      <z-stack orientation="horizontal" gap="sm" [wrap]="true">
        <z-button variant="outline" tone="neutral" (click)="selectAll()">All</z-button>
        <z-button variant="outline" tone="neutral" (click)="value.set([])">None</z-button>
      </z-stack>
      <span>Value: {{ value().join(', ') || '—' }}</span>
      <output>{{ log().join(' · ') }}</output>
    </z-stack>
  `,
})
export class TransferControlled {
  readonly roles = ROLES;
  readonly value = signal<string[]>(['read', 'comment']);
  readonly log = signal<string[]>([]);

  add(line: string) {
    this.log.update((l) => [line, ...l].slice(0, 5));
  }

  selectAll() {
    this.value.set(ROLES.filter((r) => !r.disabled).map((r) => r.value));
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZTransfer } from '@zelviora/angular';

const ROLES = [
  { value: 'read', label: 'View posts' },
  { value: 'write', label: 'Write posts' },
  { value: 'edit', label: 'Edit posts' },
  { value: 'publish', label: 'Publish posts' },
  { value: 'delete', label: 'Delete posts', description: 'Administrators only' },
  { value: 'comment', label: 'Comment' },
  { value: 'moderate', label: 'Moderate comments' },
  { value: 'users', label: 'Manage users' },
  { value: 'billing', label: 'Billing', disabled: true },
  { value: 'settings', label: 'System settings' },
];

/** Transfer tokens and parts (`::part(option-selected)`): see the `demo-transfer-brand` rule in README. */
@Component({
  selector: 'demo-transfer-customization',
  imports: [ZTransfer],
  template: `
    <z-transfer class="demo-transfer-brand" label="Customization" [items]="roles" [value]="value" [selectedSource]="ticked"></z-transfer>
  `,
})
export class TransferCustomization {
  readonly roles = ROLES.slice(0, 6);
  readonly value = ['read'];
  readonly ticked = ['write'];
}

```

### Case: default

#### Angular
```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SelectValueAccessor, ZStack, ZTransfer } from '@zelviora/angular';

const ROLES = [
  { value: 'read', label: 'View posts' },
  { value: 'write', label: 'Write posts' },
  { value: 'edit', label: 'Edit posts' },
  { value: 'publish', label: 'Publish posts' },
  { value: 'delete', label: 'Delete posts', description: 'Administrators only' },
  { value: 'comment', label: 'Comment' },
  { value: 'moderate', label: 'Moderate comments' },
  { value: 'users', label: 'Manage users' },
  { value: 'billing', label: 'Billing', disabled: true },
  { value: 'settings', label: 'System settings' },
];

/**
 * Tick items (click, Space, Shift+Arrow, Ctrl+A), then move them with the arrow buttons, Enter or a double click.
 * `[(ngModel)]` through SelectValueAccessor (model event `zChange`, array value copied as is).
 */
@Component({
  selector: 'demo-transfer-default',
  imports: [FormsModule, SelectValueAccessor, ZStack, ZTransfer],
  template: `
    <z-stack>
      <z-transfer label="Permissions" [items]="roles" [(ngModel)]="value"></z-transfer>
      <span>Value: {{ value.join(', ') || '—' }}</span>
    </z-stack>
  `,
})
export class TransferDefault {
  readonly roles = ROLES;
  value: string[] = ['read'];
}

```

### Case: form

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZField, ZStack, ZTransfer } from '@zelviora/angular';

const ROLES = [
  { value: 'read', label: 'View posts' },
  { value: 'write', label: 'Write posts' },
  { value: 'edit', label: 'Edit posts' },
  { value: 'publish', label: 'Publish posts' },
  { value: 'delete', label: 'Delete posts', description: 'Administrators only' },
  { value: 'comment', label: 'Comment' },
  { value: 'moderate', label: 'Moderate comments' },
  { value: 'users', label: 'Manage users' },
  { value: 'billing', label: 'Billing', disabled: true },
  { value: 'settings', label: 'System settings' },
];

/**
 * Native form: one FormData entry per target value; required inside a field; reset restores the default value.
 * FormsModule is not imported, so the form stays native and the element submits its own FormData entries.
 */
@Component({
  selector: 'demo-transfer-form',
  imports: [ZButton, ZField, ZStack, ZTransfer],
  template: `
    <form (submit)="submit($event)">
      <z-stack>
        <z-field label="Team permissions" hint="Select at least one permission" [required]="true">
          <z-transfer name="roles" [items]="roles" [defaultValue]="initial" [value]="initial" [required]="true"></z-transfer>
        </z-field>
        <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
          <z-button type="submit">Submit</z-button>
          <z-button type="reset" variant="outline" tone="neutral">Reset</z-button>
        </z-stack>
        @if (sent()) {
          <output>{{ sent() }}</output>
        }
      </z-stack>
    </form>
  `,
})
export class TransferForm {
  readonly roles = ROLES;
  readonly initial = ['read'];
  readonly sent = signal('');

  submit(e: Event) {
    e.preventDefault();
    this.sent.set(JSON.stringify(new FormData(e.currentTarget as HTMLFormElement).getAll('roles')));
  }
}

```

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack, ZTransfer } from '@zelviora/angular';

const ROLES = [
  { value: 'read', label: 'Xem bài viết' },
  { value: 'write', label: 'Viết bài' },
  { value: 'edit', label: 'Sửa bài' },
  { value: 'publish', label: 'Đăng bài' },
  { value: 'delete', label: 'Xoá bài', description: 'Chỉ quản trị viên' },
  { value: 'comment', label: 'Bình luận' },
  { value: 'moderate', label: 'Duyệt bình luận' },
  { value: 'billing', label: 'Thanh toán', disabled: true },
];

/** Vietnamese locale: built-in strings are Vietnamese and search ignores accents ("dang" matches "Đăng bài"). */
@Component({
  selector: 'demo-transfer-i18n',
  imports: [ZStack, ZTransfer],
  template: `
    <z-stack>
      <z-transfer lang="vi" label="Phân quyền" [items]="roles" [value]="['read']" [searchable]="true"></z-transfer>
    </z-stack>
  `,
})
export class TransferI18n {
  readonly roles = ROLES;
}

```

### Case: long

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZTransfer } from '@zelviora/angular';

/** 10 000 items: each list scrolls virtually (above 200 items); typeahead and Shift+Arrow still work. */
@Component({
  selector: 'demo-transfer-long',
  imports: [ZTransfer],
  template: `<z-transfer label="Users" [items]="many" [searchable]="true"></z-transfer>`,
})
export class TransferLong {
  readonly many = Array.from({ length: 10000 }, (_, i) => ({
    value: `u${i}`,
    label: i === 0 ? 'A very long label for the first item so you can see the text wrap inside a narrow list' : `User ${i + 1}`,
  }));
}

```

### Case: one-way

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZTransfer } from '@zelviora/angular';

const ROLES = [
  { value: 'read', label: 'View posts' },
  { value: 'write', label: 'Write posts' },
  { value: 'edit', label: 'Edit posts' },
  { value: 'publish', label: 'Publish posts' },
  { value: 'delete', label: 'Delete posts', description: 'Administrators only' },
  { value: 'comment', label: 'Comment' },
  { value: 'moderate', label: 'Moderate comments' },
  { value: 'users', label: 'Manage users' },
  { value: 'billing', label: 'Billing', disabled: true },
  { value: 'settings', label: 'System settings' },
];

/** One way: items only move to the target; each target item has its own remove button. */
@Component({
  selector: 'demo-transfer-one-way',
  imports: [ZTransfer],
  template: `
    <z-transfer label="Notification recipients" [items]="roles" [value]="value" [oneWay]="true" [titles]="titles"></z-transfer>
  `,
})
export class TransferOneWay {
  readonly roles = ROLES;
  readonly value = ['read', 'write'];
  readonly titles: [string, string] = ['Available', 'Receives notifications'];
}

```

### Case: rtl

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack, ZTransfer } from '@zelviora/angular';

const ROLES = [
  { value: 'read', label: 'View posts' },
  { value: 'write', label: 'Write posts' },
  { value: 'edit', label: 'Edit posts' },
  { value: 'publish', label: 'Publish posts' },
  { value: 'delete', label: 'Delete posts', description: 'Administrators only' },
  { value: 'comment', label: 'Comment' },
  { value: 'moderate', label: 'Moderate comments' },
  { value: 'users', label: 'Manage users' },
  { value: 'billing', label: 'Billing', disabled: true },
  { value: 'settings', label: 'System settings' },
];

/** RTL swaps the move arrows; with no item both lists show their empty state (slot `empty-source`). */
@Component({
  selector: 'demo-transfer-rtl',
  imports: [ZStack, ZTransfer],
  template: `
    <z-stack gap="lg">
      <div dir="rtl" lang="ar">
        <z-transfer label="RTL" [items]="few" [value]="value"></z-transfer>
      </div>
      <z-transfer label="Empty" [items]="none">
        <span slot="empty-source">No permissions yet</span>
      </z-transfer>
    </z-stack>
  `,
})
export class TransferRtl {
  readonly few = ROLES.slice(0, 4);
  readonly value = ['read'];
  readonly none: typeof ROLES = [];
}

```

### Case: searchable

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZStack, ZTransfer } from '@zelviora/angular';

const ROLES = [
  { value: 'read', label: 'View posts' },
  { value: 'write', label: 'Write posts' },
  { value: 'edit', label: 'Edit posts' },
  { value: 'publish', label: 'Publish posts' },
  { value: 'delete', label: 'Delete posts', description: 'Administrators only' },
  { value: 'comment', label: 'Comment' },
  { value: 'moderate', label: 'Moderate comments' },
  { value: 'users', label: 'Manage users' },
  { value: 'billing', label: 'Billing', disabled: true },
  { value: 'settings', label: 'System settings' },
];

/** Search on each side (case-insensitive: "publish" matches "Publish posts"); results are announced. */
@Component({
  selector: 'demo-transfer-searchable',
  imports: [ZStack, ZTransfer],
  template: `
    <z-stack>
      <z-transfer label="Permissions" [items]="roles" [searchable]="true" (zSearch)="query.set($event.detail.side + ': ' + $event.detail.query)"></z-transfer>
      <span>zSearch: {{ query() || '—' }}</span>
    </z-stack>
  `,
})
export class TransferSearchable {
  readonly roles = ROLES;
  readonly query = signal('');
}

```

### Case: sizes

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack, ZTransfer } from '@zelviora/angular';

const ROLES = [
  { value: 'read', label: 'View posts' },
  { value: 'write', label: 'Write posts' },
  { value: 'edit', label: 'Edit posts' },
  { value: 'publish', label: 'Publish posts' },
  { value: 'delete', label: 'Delete posts', description: 'Administrators only' },
  { value: 'comment', label: 'Comment' },
  { value: 'moderate', label: 'Moderate comments' },
  { value: 'users', label: 'Manage users' },
  { value: 'billing', label: 'Billing', disabled: true },
  { value: 'settings', label: 'System settings' },
];

/** Small, medium (default) and large rows. */
@Component({
  selector: 'demo-transfer-sizes',
  imports: [ZStack, ZTransfer],
  template: `
    <z-stack gap="lg">
      @for (size of sizes; track size) {
        <z-transfer [label]="'Size ' + size" [size]="size" [items]="roles" [value]="value"></z-transfer>
      }
    </z-stack>
  `,
})
export class TransferSizes {
  readonly sizes = ['sm', 'md', 'lg'] as const;
  readonly roles = ROLES.slice(0, 4);
  readonly value = ['read'];
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack, ZTransfer } from '@zelviora/angular';

const ROLES = [
  { value: 'read', label: 'View posts' },
  { value: 'write', label: 'Write posts' },
  { value: 'edit', label: 'Edit posts' },
  { value: 'publish', label: 'Publish posts' },
  { value: 'delete', label: 'Delete posts', description: 'Administrators only' },
  { value: 'comment', label: 'Comment' },
  { value: 'moderate', label: 'Moderate comments' },
  { value: 'users', label: 'Manage users' },
  { value: 'billing', label: 'Billing', disabled: true },
  { value: 'settings', label: 'System settings' },
];

/** A disabled item ("Billing"), ticked items, the whole control disabled, readonly and invalid. */
@Component({
  selector: 'demo-transfer-states',
  imports: [ZStack, ZTransfer],
  template: `
    <z-stack gap="lg">
      <z-transfer label="Ticked items and a disabled item" [items]="roles" [value]="value" [selectedSource]="ticked"></z-transfer>
      <z-transfer label="Disabled" [items]="few" [value]="value" [disabled]="true"></z-transfer>
      <z-transfer label="Readonly" [items]="few" [value]="value" [readonly]="true"></z-transfer>
      <z-transfer label="Invalid" [items]="few" [invalid]="true" hint="Select at least one permission"></z-transfer>
    </z-stack>
  `,
})
export class TransferStates {
  readonly roles = ROLES;
  readonly few = ROLES.slice(0, 4);
  readonly value = ['read'];
  readonly ticked = ['write', 'edit'];
}

```


================================================================================
# COMPONENT: TREE-CHART
================================================================================

## Documentation

# Tree chart (`<z-tree-chart>`)

Orthogonal and radial hierarchical node-link tree diagrams with collapsible branches.

## Installation & Import

```tsx
// React (@zelviora/react-chart)
import { ZTreeChart } from '@zelviora/react-chart';

// Vue 3 (@zelviora/vue-chart)
import { ZTreeChart } from '@zelviora/vue-chart';

// Angular (@zelviora/angular-chart)
import { ZTreeChart } from '@zelviora/angular-chart';

// Web Components (@zelviora/chart)
import '@zelviora/chart';
```

## Key Features

- **Tree-shaken ECharts 6 Core**: Automatically registers only the required ECharts chart module and components.
- **Design System Token Synchronization**: Reads `--z-chart-series-1..8`, `--z-chart-grid-color`, and `--z-chart-axis-color`, reacting automatically to Light/Dark mode and theme preset changes.
- **Built-in Accessibility (WCAG AAA)**: Renders a semantic `<figure>` with `<figcaption>`, interactive `aria-pressed` legend toggles, and a synchronized `<table>` for screen readers.
- **Escape Hatch (`option`)**: Deep-merges any raw ECharts `option` object on top of the declarative props.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZTreeChart } from '@zelviora/angular-chart';
import { topologyTree, topologySeries } from '../data';

@Component({
  selector: 'demo-tree-chart-basic',
  imports: [ZTreeChart],
  template: `
    <z-tree-chart
      heading="Platform Service Topology Tree"
      description="Hierarchical topology from Edge Ingress down to regional microservice clusters."
      [treeData]="treeData" [series]="series"
    ></z-tree-chart>
  `,
})
export class TreeChartBasic {
  readonly treeData = topologyTree;
  readonly series = topologySeries;
}

```

### Case: controlled

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/angular';
import { ZTreeChart, type ChartPointSelectDetail, type ChartSeriesToggleDetail } from '@zelviora/angular-chart';
import { topologyTree, topologySeries } from '../data';

@Component({
  selector: 'demo-tree-chart-controlled',
  imports: [ZStack, ZButton, ZBadge, ZText, ZTreeChart],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <z-button size="sm" variant="outline" (click)="hidden = []">
          Show All Series
        </z-button>
        <z-badge tone="primary" variant="soft">{{ selected }}</z-badge>
        <z-text variant="muted" size="sm">
          Hidden: {{ hidden.length ? hidden.join(', ') : 'none' }}
        </z-text>
      </z-stack>
      <z-tree-chart
        heading="Platform Service Topology Tree (Interactive)"
        description="Hierarchical topology from Edge Ingress down to regional microservice clusters."
        [treeData]="treeData" [series]="series"
        [selectable]="true"
        [hiddenSeries]="hidden"
        (zSeriesToggle)="onToggle($event)"
        (zPointSelect)="onSelect($event)"
      ></z-tree-chart>
    </z-stack>
  `,
})
export class TreeChartControlled {
  readonly treeData = topologyTree;
  readonly series = topologySeries;
  hidden: string[] = [];
  selected = 'Click any chart element to inspect';

  onToggle(e: CustomEvent<ChartSeriesToggleDetail>) {
    this.hidden = e.detail.hiddenSeries;
  }

  onSelect(e: CustomEvent<ChartPointSelectDetail>) {
    this.selected = `Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`;
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZTreeChart } from '@zelviora/angular-chart';
import { topologyTree, topologySeries } from '../data';

@Component({
  selector: 'demo-tree-chart-customization',
  imports: [ZTreeChart],
  template: `
    <z-tree-chart
      class="demo-chart-brand"
      description="Hierarchical topology from Edge Ingress down to regional microservice clusters."
      [valueFormat]="{ maximumFractionDigits: 1 }"
      [treeData]="treeData" [series]="series" [roam]="true" [symbolSize]="12" renderer="canvas"
    >
      <span slot="heading">Platform Service Topology Tree — Custom Theme Tokens &amp; Canvas</span>
    </z-tree-chart>
  `,
})
export class TreeChartCustomization {
  readonly treeData = topologyTree;
  readonly series = topologySeries;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZTreeChart } from '@zelviora/angular-chart';
import { topologyTree, topologySeries } from '../data';

@Component({
  selector: 'demo-tree-chart-states',
  imports: [ZStack, ZTreeChart],
  template: `
    <z-stack gap="lg">
      <z-tree-chart
        heading="Loading State (aria-busy)"
        [loading]="true"
        [treeData]="treeData" [series]="series"
      ></z-tree-chart>
      <z-tree-chart
        heading="Empty State"
        [treeData]="[]"
        [series]="series"
      ></z-tree-chart>
      <z-tree-chart
        heading="Expanded Accessible Data Table"
        description="Hierarchical topology from Edge Ingress down to regional microservice clusters."
        [showDataTable]="true"
        [treeData]="treeData" [series]="series"
      ></z-tree-chart>
    </z-stack>
  `,
})
export class TreeChartStates {
  readonly treeData = topologyTree;
  readonly series = topologySeries;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZTreeChart } from '@zelviora/angular-chart';
import { topologyTree, topologySeries } from '../data';

@Component({
  selector: 'demo-tree-chart-variants',
  imports: [ZStack, ZTreeChart],
  template: `
    <z-stack gap="lg">
      <z-tree-chart
        heading="Top-to-Bottom Orthogonal Tree"
        description="Top-to-bottom orthogonal hierarchy vs radial circular tree layout."
        [treeData]="treeData" [series]="series" treeLayout="orthogonal" treeOrient="TB" [symbolSize]="10"
      ></z-tree-chart>
      <z-tree-chart
        heading="Radial Tree Layout"
        description="Top-to-bottom orthogonal hierarchy vs radial circular tree layout."
        [treeData]="treeData" [series]="series" treeLayout="radial" [initialTreeDepth]="2"
      ></z-tree-chart>
    </z-stack>
  `,
})
export class TreeChartVariants {
  readonly treeData = topologyTree;
  readonly series = topologySeries;
}

```


================================================================================
# COMPONENT: TREE-SELECT
================================================================================

## Documentation

# tree-select — Angular

Processed requirements of [`<z-tree-select>`](../../../../../requirements/04-components/form/tree-select.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-tree-select name="team" label="Departments" [options]="departments" [(ngModel)]="team"></z-tree-select>
```

## Binding

| Value accessor | Model | Event | Detail |
|---|---|---|---|
| `SelectValueAccessor` | `[(ngModel)]` / `formControl` (`string \| null`, `string[]` with `multiple` / `checkable`) | `(zChange)` | `{ value, node }` |
| — | `[open]` (no two-way binding, D-031) | `(zOpenChange)` | `{ open, reason }` |

`checkedValue` (checkable, read only) is the detail of `(zCheckedChange)`.

## Events

`(zChange)`, `(zExpandedChange)`, `(zCheckedChange)`, `(zSearch)`, `(zRemove)`, `(zOpenChange)`, `(zBeforeOpen)`, `(zBeforeClose)`, `(zAfterOpen)`, `(zAfterClose)`, `(zClear)`, `(zError)`.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `tree-select-default.ts` | D-1 Default, D-3 `outline` / `filled`, D-6 States, D-7 Disabled (tree, node) |
| `multiple` | `tree-select-multiple.ts` | D-21 Multiple (tags, `maxCount`) |
| `checkable` | `tree-select-checkable.ts` | D-22 Checkable × 3 `checkStrategy` |
| `search` | `tree-select-search.ts` | D-23 Searchable, D-24 `loadChildren` |
| `form` | `tree-select-form.ts` | D-10 In form, D-8 Error (required), D-25 5,000 nodes (virtual) |
| `i18n` | `tree-select-i18n.ts` | D-19 i18n |

Not applicable: D-4 tones. Not yet covered: D-2 playground, D-9 controlled from buttons, D-11 RTL, D-12 dark,
D-13 brand showcase, D-14 long content, D-17 composition, D-18 customization, D-19 i18n.

## Differences

- Value order: `value` keeps the order chosen; form entries follow the tree order (FV-3).
- Form reset does not emit events: reset the bound value yourself.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: checkable

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZStack, ZTreeSelect } from '@zelviora/angular';
import { departments } from '../data';

/** Tri-state check boxes with cascade; the value kept follows checkStrategy (parent / child / all). */
@Component({
  selector: 'demo-tree-select-checkable',
  imports: [ZStack, ZTreeSelect],
  template: `
    <z-stack class="demo-narrow">
      @for (s of strategies; track s) {
        <z-stack gap="xs">
          <z-tree-select [label]="'checkStrategy: ' + s" [checkable]="true" [checkStrategy]="s" maxTagCount="responsive" [options]="departments" [value]="values()[s]" (zChange)="set(s, $any($event.detail.value))"></z-tree-select>
          <span>Value: {{ values()[s].join(', ') || 'none' }}</span>
        </z-stack>
      }
    </z-stack>
  `,
})
export class TreeSelectCheckable {
  readonly departments = departments;
  readonly strategies = ['parent', 'child', 'all'] as const;
  readonly values = signal<Record<string, string[]>>({ parent: ['eng'], child: ['eng'], all: ['eng'] });

  set(s: string, v: string[]) {
    this.values.update((all) => ({ ...all, [s]: v }));
  }
}

```

### Case: default

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZStack, ZTreeSelect } from '@zelviora/angular';
import { departments } from '../data';

/** Single value at any level, a disabled node, clear button; disabled and readonly states. */
@Component({
  selector: 'demo-tree-select-default',
  imports: [ZStack, ZTreeSelect],
  template: `
    <z-stack class="demo-narrow">
      <z-tree-select label="Departments" [options]="departments" [value]="value()" [clearable]="true" (zChange)="value.set($any($event.detail.value))"></z-tree-select>
      <span>Value: {{ value() ?? 'null' }}</span>
      <z-tree-select label="Disabled" [options]="departments" value="acc" [disabled]="true"></z-tree-select>
      <z-tree-select label="Readonly" [options]="departments" value="acc" [readonly]="true" variant="filled"></z-tree-select>
    </z-stack>
  `,
})
export class TreeSelectDefault {
  readonly departments = departments;
  readonly value = signal<string | null>('be');
}

```

### Case: form

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZStack, ZTreeSelect } from '@zelviora/angular';
import { bigTree, departments } from '../data';

/**
 * Required value in a native form (one FormData entry per value, in tree order); 5,000 nodes are virtual.
 * FormsModule is not imported, so the form stays native and the element submits its own FormData entries.
 */
@Component({
  selector: 'demo-tree-select-form',
  imports: [ZButton, ZStack, ZTreeSelect],
  template: `
    <form class="demo-narrow" (submit)="submit($event)">
      <z-stack>
        <z-tree-select name="teams" label="Departments" hint="Required" [required]="true" [checkable]="true" checkStrategy="child" [options]="departments"></z-tree-select>
        <z-tree-select name="item" label="Large catalog (5,000 nodes)" [searchable]="true" [options]="bigTree"></z-tree-select>
        <z-stack orientation="horizontal" [wrap]="true" align-items="center" gap="sm">
          <z-button type="submit">Submit</z-button>
          <z-button type="reset" variant="outline" tone="neutral">Reset</z-button>
        </z-stack>
        @if (sent()) {
          <output>{{ sent() }}</output>
        }
      </z-stack>
    </form>
  `,
})
export class TreeSelectForm {
  readonly departments = departments;
  readonly bigTree = bigTree;
  readonly sent = signal('');

  submit(e: Event) {
    e.preventDefault();
    const data = new FormData(e.currentTarget as HTMLFormElement);
    this.sent.set(JSON.stringify({ teams: data.getAll('teams'), item: data.get('item') }));
  }
}

```

### Case: i18n

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZConfigProvider, ZTreeSelect } from '@zelviora/angular';
import { departments } from '../data-i18n';

/** With locale `vi` the search ignores accents ("ke toan" finds "Kế toán" with its ancestors) and the built-in texts are Vietnamese. */
@Component({
  selector: 'demo-tree-select-i18n',
  imports: [ZConfigProvider, ZTreeSelect],
  template: `
    <z-config-provider locale="vi">
      <div class="demo-narrow">
        <z-tree-select label="Tìm phòng ban" [searchable]="true" [options]="departments"></z-tree-select>
      </div>
    </z-config-provider>
  `,
})
export class TreeSelectI18n {
  readonly departments = departments;
}

```

### Case: multiple

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZStack, ZTreeSelect } from '@zelviora/angular';
import { departments } from '../data';

/** Several nodes as tags (the popup stays open); at most 3 values. */
@Component({
  selector: 'demo-tree-select-multiple',
  imports: [ZStack, ZTreeSelect],
  template: `
    <z-stack class="demo-narrow">
      <z-tree-select label="Owner groups" [multiple]="true" [clearable]="true" [maxCount]="3" [options]="departments" [value]="value()" (zChange)="value.set($any($event.detail.value))"></z-tree-select>
      <span>Value: {{ value().join(', ') || 'none' }}</span>
    </z-stack>
  `,
})
export class TreeSelectMultiple {
  readonly departments = departments;
  readonly value = signal<string[]>(['web', 'acc']);
}

```

### Case: search

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZStack, ZTreeSelect } from '@zelviora/angular';
import { departments, lazyRoots, loadOffices } from '../data';

/** Search shows matches with their ancestors; children loaded on expand. */
@Component({
  selector: 'demo-tree-select-search',
  imports: [ZStack, ZTreeSelect],
  template: `
    <z-stack class="demo-narrow">
      <z-tree-select label="Find department" [searchable]="true" [options]="departments" (zSearch)="query.set($event.detail.query)"></z-tree-select>
      <span>Query: {{ query() || '—' }}</span>
      <z-tree-select label="Offices (lazy)" [options]="lazyRoots" [loadChildren]="loadOffices"></z-tree-select>
    </z-stack>
  `,
})
export class TreeSelectSearch {
  readonly departments = departments;
  readonly lazyRoots = lazyRoots;
  readonly loadOffices = loadOffices;
  readonly query = signal('');
}

```


================================================================================
# COMPONENT: TREE-VIEW
================================================================================

## Documentation

# tree-view — Angular

Processed requirements of [`<z-tree-view>`](../../../../../requirements/04-components/data-display/tree-view.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-tree-view label="Folders" [items]="folders" [value]="value()" (zSelectionChange)="value.set($event.detail.value)"></z-tree-view>
```

Declarative mode (no `items`): nested tree items are the nodes; events and bindings stay the same.

```html
<z-tree-view label="Documents">
  <z-tree-item value="docs" label="Documents">
    <z-tree-item value="contracts" label="Contracts"></z-tree-item>
  </z-tree-item>
</z-tree-view>
```

## Binding

| Prop | Event | Detail |
|---|---|---|
| `[value]` (`string \| string[] \| null`; not a form control, no value accessor) | `(zSelectionChange)` | `{ value, node }` |
| `[checkedValue]` (`string[]`) | `(zCheckedChange)` | `{ checkedValue, node }` |
| `[expandedValue]` (`string[]`) | `(zExpandedChange)` | `{ value, expanded, expandedValue, reason }` |

## Events

`(zSelectionChange)`, `(zCheckedChange)`, `(zExpandedChange)`, `(zError)`, `(zReorder)` (`{ sourceValue, targetValue, position }`). Inputs also include `[nodes]` (alias of `[items]`), `filter`, `[cascadeSelection]`, and `[reorderable]`.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `tree-view-default.ts` | D-1 Default (3 levels), D-5 Sizes, D-7 Disabled node |
| `checkable` | `tree-view-checkable.ts` | D-21 Checkable cascade |
| `lazy` | `tree-view-lazy.ts` | D-8 Error (`loadChildren` fails once), D-20 Empty / loading |
| `controlled` | `tree-view-controlled.ts` | D-9 Controlled (`value` / `expandedValue`, expand all from code) |
| `virtual` | `tree-view-virtual.ts` | D-22 10,000 nodes (virtual) |
| `declarative` | `tree-view-declarative.ts` | D-23 Declarative (nested tree items, `label` slot, items added / removed) |

Not applicable: D-3 variants, D-4 tones, D-10 in form (use the tree select). Not yet covered: D-2 playground, D-11 RTL,
D-12 dark, D-13 brand showcase, D-14 long content, D-17 composition, D-18 customization, D-19 i18n.

The virtual demo gives the tree a fixed height with a demo class:

```css
.demo-tree-frame {
  block-size: calc(var(--z-space-24) * 3);
}
```

## Differences

- Two modes: data (`items`, flat rows, virtual scrolling, lazy children) and declarative (nested tree items in the
  markup; no virtual scrolling, no lazy children). A non-empty `items` wins over the tree items.
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: checkable

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZStack, ZTreeView } from '@zelviora/angular';
import { departments } from '../data';

/** Tri-state check boxes with cascade (the disabled team is skipped); `checkedValue` bound back from the event. */
@Component({
  selector: 'demo-tree-view-checkable',
  imports: [ZStack, ZTreeView],
  template: `
    <z-stack class="demo-narrow">
      <z-tree-view
        label="Departments"
        [checkable]="true"
        selectionMode="none"
        [items]="departments"
        [checkedValue]="checked()"
        [defaultExpandedValue]="['eng', 'fin']"
        (zCheckedChange)="checked.set($event.detail.checkedValue)"
      ></z-tree-view>
      <span>Checked: {{ checked().length ? checked().join(', ') : 'none' }}</span>
    </z-stack>
  `,
})
export class TreeViewCheckable {
  readonly departments = departments;
  readonly checked = signal<string[]>(['fe']);
}

```

### Case: controlled

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZStack, ZTreeView } from '@zelviora/angular';
import { folders } from '../data';

/** The app owns `value` and `expandedValue`: buttons set them from code (no event), user changes come back by event. */
@Component({
  selector: 'demo-tree-view-controlled',
  imports: [ZButton, ZStack, ZTreeView],
  template: `
    <z-stack class="demo-narrow">
      <z-stack orientation="horizontal" gap="sm" [wrap]="true">
        <z-button variant="outline" tone="neutral" (click)="expanded.set(allParents)">Expand all</z-button>
        <z-button variant="outline" tone="neutral" (click)="expanded.set([])">Collapse all</z-button>
        <z-button variant="outline" tone="neutral" (click)="expanded.set(['docs', 'reports']); value.set('q2')">Select Q2</z-button>
      </z-stack>
      <z-tree-view
        label="Folders"
        [items]="folders"
        [value]="value()"
        [expandedValue]="expanded()"
        (zSelectionChange)="value.set($any($event.detail.value))"
        (zExpandedChange)="expanded.set($event.detail.expandedValue)"
      ></z-tree-view>
      <span>Value: {{ value() ?? 'null' }} · Expanded: {{ expanded().join(', ') || 'none' }}</span>
    </z-stack>
  `,
})
export class TreeViewControlled {
  readonly folders = folders;
  readonly allParents = ['docs', 'reports', 'images'];
  readonly value = signal<string | null>(null);
  readonly expanded = signal<string[]>([]);
}

```

### Case: declarative

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZButton, ZStack, ZTreeItem, ZTreeView } from '@zelviora/angular';

/**
 * Declarative mode: nested tree items in the markup instead of `items`. A rich label goes in the `label` slot; items
 * added or removed at run time join the keyboard navigation at once.
 */
@Component({
  selector: 'demo-tree-view-declarative',
  imports: [ZButton, ZStack, ZTreeItem, ZTreeView],
  template: `
    <z-stack class="demo-narrow">
      <z-stack orientation="horizontal" gap="sm" [wrap]="true">
        <z-button variant="outline" tone="neutral" (click)="add()">Add draft</z-button>
        <z-button variant="outline" tone="neutral" [disabled]="!drafts().length" (click)="remove()">Remove draft</z-button>
      </z-stack>
      <z-tree-view label="Documents" [value]="value()" [defaultExpandedValue]="['docs', 'reports']" (zSelectionChange)="value.set($any($event.detail.value))">
        <z-tree-item value="docs" label="Documents">
          <z-tree-item value="contracts" label="Contracts"></z-tree-item>
          <z-tree-item value="reports" label="Reports">
            <z-tree-item value="q1" label="Q1"></z-tree-item>
            <z-tree-item value="q2" label="Q2"></z-tree-item>
            <z-tree-item value="q3" label="Q3 (locked)" [disabled]="true"></z-tree-item>
          </z-tree-item>
          @for (d of drafts(); track d; let i = $index) {
            <z-tree-item [value]="d" [label]="'Draft ' + (i + 1)"></z-tree-item>
          }
        </z-tree-item>
        <z-tree-item value="inbox">
          <span slot="label"><strong>Inbox</strong> · 3 unread</span>
        </z-tree-item>
      </z-tree-view>
      <span>Value: {{ value() ?? 'null' }}</span>
    </z-stack>
  `,
})
export class TreeViewDeclarative {
  readonly value = signal<string | null>('q1');
  readonly drafts = signal<string[]>([]);

  add() { this.drafts.update((d) => [...d, `draft-${d.length + 1}`]); }
  remove() { this.drafts.update((d) => d.slice(0, -1)); }
}

```

### Case: default

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZStack, ZTreeView } from '@zelviora/angular';
import { folders } from '../data';

/** Three levels of folders, single selection, a disabled node (focusable, not selectable), three sizes. */
@Component({
  selector: 'demo-tree-view-default',
  imports: [ZStack, ZTreeView],
  template: `
    <z-stack class="demo-narrow">
      <z-tree-view label="Folders" [items]="folders" [value]="value()" [defaultExpandedValue]="['docs', 'reports']" (zSelectionChange)="value.set($any($event.detail.value))"></z-tree-view>
      <span>Value: {{ value() ?? 'null' }}</span>
      <z-tree-view label="Folders (small)" size="sm" [items]="folders"></z-tree-view>
      <z-tree-view label="Folders (large)" size="lg" [items]="folders"></z-tree-view>
    </z-stack>
  `,
})
export class TreeViewDefault {
  readonly folders = folders;
  readonly value = signal<string | null>('q1');
}

```

### Case: lazy

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZStack, ZTreeView } from '@zelviora/angular';
import { lazyRoots, loadRegions } from '../data';

/** Children loaded on expand (fixed delay); "Archive" fails once: the error event fires, expanding again retries. */
@Component({
  selector: 'demo-tree-view-lazy',
  imports: [ZStack, ZTreeView],
  template: `
    <z-stack class="demo-narrow">
      <z-tree-view label="Regions" [items]="lazyRoots" [loadChildren]="loadRegions" (zError)="log.set('zError: ' + $event.detail.node.label)"></z-tree-view>
      <output>{{ log() }}</output>
      <z-tree-view label="Empty" [items]="[]"></z-tree-view>
    </z-stack>
  `,
})
export class TreeViewLazy {
  readonly lazyRoots = lazyRoots;
  readonly loadRegions = loadRegions;
  readonly log = signal('');
}

```

### Case: virtual

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZTreeView } from '@zelviora/angular';
import { bigExpanded, bigTree } from '../data';

/** 10 100 visible nodes: only the rows in view are rendered (virtual="auto" above 500 visible nodes). */
@Component({
  selector: 'demo-tree-view-virtual',
  imports: [ZTreeView],
  template: `<z-tree-view class="demo-tree-frame" label="Large catalog" selectionMode="multiple" [items]="bigTree" [defaultExpandedValue]="bigExpanded"></z-tree-view>`,
})
export class TreeViewVirtual {
  readonly bigTree = bigTree;
  readonly bigExpanded = bigExpanded;
}

```


================================================================================
# COMPONENT: TREEMAP-CHART
================================================================================

## Documentation

# Treemap chart (`<z-treemap-chart>`)

Nested rectangular treemap for hierarchical space, cost, and bundle size analysis.

## Installation & Import

```tsx
// React (@zelviora/react-chart)
import { ZTreemapChart } from '@zelviora/react-chart';

// Vue 3 (@zelviora/vue-chart)
import { ZTreemapChart } from '@zelviora/vue-chart';

// Angular (@zelviora/angular-chart)
import { ZTreemapChart } from '@zelviora/angular-chart';

// Web Components (@zelviora/chart)
import '@zelviora/chart';
```

## Key Features

- **Tree-shaken ECharts 6 Core**: Automatically registers only the required ECharts chart module and components.
- **Design System Token Synchronization**: Reads `--z-chart-series-1..8`, `--z-chart-grid-color`, and `--z-chart-axis-color`, reacting automatically to Light/Dark mode and theme preset changes.
- **Built-in Accessibility (WCAG AAA)**: Renders a semantic `<figure>` with `<figcaption>`, interactive `aria-pressed` legend toggles, and a synchronized `<table>` for screen readers.
- **Escape Hatch (`option`)**: Deep-merges any raw ECharts `option` object on top of the declarative props.


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZTreemapChart } from '@zelviora/angular-chart';
import { bundleTree, bundleSeries } from '../data';

@Component({
  selector: 'demo-treemap-chart-basic',
  imports: [ZTreemapChart],
  template: `
    <z-treemap-chart
      heading="Workspace Bundle Size Breakdown (kB)"
      description="Hierarchical distribution of compiled asset sizes across packages."
      [treeData]="treeData" [series]="series"
    ></z-treemap-chart>
  `,
})
export class TreemapChartBasic {
  readonly treeData = bundleTree;
  readonly series = bundleSeries;
}

```

### Case: controlled

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/angular';
import { ZTreemapChart, type ChartPointSelectDetail, type ChartSeriesToggleDetail } from '@zelviora/angular-chart';
import { bundleTree, bundleSeries } from '../data';

@Component({
  selector: 'demo-treemap-chart-controlled',
  imports: [ZStack, ZButton, ZBadge, ZText, ZTreemapChart],
  template: `
    <z-stack gap="md">
      <z-stack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <z-button size="sm" variant="outline" (click)="hidden = []">
          Show All Series
        </z-button>
        <z-badge tone="primary" variant="soft">{{ selected }}</z-badge>
        <z-text variant="muted" size="sm">
          Hidden: {{ hidden.length ? hidden.join(', ') : 'none' }}
        </z-text>
      </z-stack>
      <z-treemap-chart
        heading="Workspace Bundle Size Breakdown (kB) (Interactive)"
        description="Hierarchical distribution of compiled asset sizes across packages."
        [treeData]="treeData" [series]="series"
        [selectable]="true"
        [hiddenSeries]="hidden"
        (zSeriesToggle)="onToggle($event)"
        (zPointSelect)="onSelect($event)"
      ></z-treemap-chart>
    </z-stack>
  `,
})
export class TreemapChartControlled {
  readonly treeData = bundleTree;
  readonly series = bundleSeries;
  hidden: string[] = [];
  selected = 'Click any chart element to inspect';

  onToggle(e: CustomEvent<ChartSeriesToggleDetail>) {
    this.hidden = e.detail.hiddenSeries;
  }

  onSelect(e: CustomEvent<ChartPointSelectDetail>) {
    this.selected = `Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`;
  }
}

```

### Case: customization

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZTreemapChart } from '@zelviora/angular-chart';
import { bundleTree, bundleSeries } from '../data';

@Component({
  selector: 'demo-treemap-chart-customization',
  imports: [ZTreemapChart],
  template: `
    <z-treemap-chart
      class="demo-chart-brand"
      description="Hierarchical distribution of compiled asset sizes across packages."
      [valueFormat]="{ maximumFractionDigits: 1 }"
      [treeData]="treeData" [series]="series" roam="scale" renderer="canvas"
    >
      <span slot="heading">Workspace Bundle Size Breakdown (kB) — Custom Theme Tokens &amp; Canvas</span>
    </z-treemap-chart>
  `,
})
export class TreemapChartCustomization {
  readonly treeData = bundleTree;
  readonly series = bundleSeries;
}

```

### Case: states

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZTreemapChart } from '@zelviora/angular-chart';
import { bundleTree, bundleSeries } from '../data';

@Component({
  selector: 'demo-treemap-chart-states',
  imports: [ZStack, ZTreemapChart],
  template: `
    <z-stack gap="lg">
      <z-treemap-chart
        heading="Loading State (aria-busy)"
        [loading]="true"
        [treeData]="treeData" [series]="series"
      ></z-treemap-chart>
      <z-treemap-chart
        heading="Empty State"
        [treeData]="[]"
        [series]="series"
      ></z-treemap-chart>
      <z-treemap-chart
        heading="Expanded Accessible Data Table"
        description="Hierarchical distribution of compiled asset sizes across packages."
        [showDataTable]="true"
        [treeData]="treeData" [series]="series"
      ></z-treemap-chart>
    </z-stack>
  `,
})
export class TreemapChartStates {
  readonly treeData = bundleTree;
  readonly series = bundleSeries;
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZStack } from '@zelviora/angular';
import { ZTreemapChart } from '@zelviora/angular-chart';
import { bundleTree, bundleSeries } from '../data';

@Component({
  selector: 'demo-treemap-chart-variants',
  imports: [ZStack, ZTreemapChart],
  template: `
    <z-stack gap="lg">
      <z-treemap-chart
        heading="Interactive Roam & Breadcrumb"
        description="Interactive roam & breadcrumb trail vs static overview without breadcrumbs."
        [treeData]="treeData" [series]="series" [roam]="true" [showBreadcrumb]="true"
      ></z-treemap-chart>
      <z-treemap-chart
        heading="Static Compact Treemap"
        description="Interactive roam & breadcrumb trail vs static overview without breadcrumbs."
        [treeData]="treeData" [series]="series" [showBreadcrumb]="false"
      ></z-treemap-chart>
    </z-stack>
  `,
})
export class TreemapChartVariants {
  readonly treeData = bundleTree;
  readonly series = bundleSeries;
}

```


================================================================================
# COMPONENT: VIRTUAL-LIST
================================================================================

## Documentation

# virtual-list — Angular

Processed requirements of [`<z-virtual-list>`](../../../../../requirements/04-components/advanced/virtual-list.md) for
Angular (`@zelviora/angular`, standalone components).

## Usage

Slot mode (spec §4.1, §12): keep the range of `zRangeChange` in a signal and render `items[start..end]` as light DOM
children whose slot is `item-<key>` (`getItemKey`). App CSS applies to them as usual.

```html
<z-virtual-list label="Contacts" [items]="items" [getItemKey]="key" (zRangeChange)="range.set($event.detail)">
  @for (c of visible(); track c.key) {
    <div [attr.slot]="'item-' + c.key" class="demo-virtual-row">{{ c.name }}</div>
  }
</z-virtual-list>
```

```ts
readonly range = signal<ZVirtualListRangeChangeDetail>({ start: 0, end: 30 }); // first paint before zRangeChange
readonly visible = computed(() => this.items.slice(this.range().start, this.range().end + 1));
```

Functions and arrays (`items`, `getItemKey`, `formatLabel`, `groups`) are bound with `[prop]="…"`.

## Binding and events

`listRole="listbox"` only; not a form control (spec §12, `model-events.ts`): bind `[value]` + `(zSelect)`, no `ngModel`.

| Input | Output | Detail |
|---|---|---|
| `[value]` (listbox, item key) | `(zSelect)` | `{ value, item }` |
| | `(zRangeChange)` | `{ start, end }` (overscan and the focused item included; `-1` when empty) |
| `[loadMore]`, `[loading]` | `(zLoadMore)` | `{}` |
| | `(zScrollEnd)` | `{ scrollTop, scrollLeft }` |

Methods through `viewChild(ZVirtualList)`: `scrollToIndex(index, { align, behavior })`, `scrollToKey(key, …)`, `measure()`.

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `default` | `virtual-list-default.ts` | D-1 Default (10 000 items, slot mode) |
| `variants` | `virtual-list-variants.ts` | D-3 Variants (feed, listbox), D-15 Keyboard-only |
| `grouped` | `virtual-list-grouped.ts` | D-21 Grouped (A–Z directory, sticky headers) |
| `load-more` | `virtual-list-load-more.ts` | D-17 Composition (infinite load with `loadMore` + `zLoadMore`), D-6 / D-20 loading |
| `controlled` | `virtual-list-controlled.ts` | D-9 Controlled (`scrollToIndex` / `scrollToKey`, listbox `value`) |

Not yet covered: D-2 playground, D-11 RTL, D-12 dark / D-13 brand (theme switch of the docs site), D-14 long content
(`dynamicSize`), D-16 density, D-18 customization (`::part(item)`, `renderItem` + `itemStyles`), D-19 i18n.
Not applicable: D-4, D-5, D-7, D-8, D-10.

## Demo classes

The list needs a bounded height. The demos set it through the component token and lay out each slotted row with these
rules of `src/styles/demo.css` (copy them into the app stylesheet). The demo data comes from `data.ts`, generated from
`documents/shared/virtual-list/data.ts` (same items in React, Vue and Angular):

```css
/* Height of a virtual list demo through its token (the app gives the scroll area its size). */
.demo-virtual-list {
  --z-virtual-list-max-height: calc(var(--z-space-24) * 3.5);
  border: var(--z-border-width-1) solid var(--z-color-border);
  border-radius: var(--z-radius-md);
}

/* One row of a virtual list in slot mode: fills the fixed item height, content centered vertically. */
.demo-virtual-row {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: var(--z-space-2);
  block-size: 100%;
  padding-inline: var(--z-space-3);
}
```

The feed rows have two lines, so that list measures its items (`[dynamicSize]="true"`).

## Differences

- No portal adapter: the light DOM rows rendered by `@for` are the item content; rows outside the range are dropped by
  Angular when `visible()` changes.
- Keys must match `[A-Za-z0-9_-]` (they are part of a slot name).
- `value` set by code does not emit `zSelect` and does not scroll (the controlled case shows the option with
  `scrollToKey()` from its "Show selected" button).
- The tag and package scope in the code are those of the source brand (`z-`, `@zelviora`); brand builds rewrite them (DOC-3).


## Examples & Implementation

### Case: controlled

#### Angular
```typescript
import { Component, computed, signal, viewChild } from '@angular/core';
import type { ZVirtualListRangeChangeDetail } from '@zelviora/core';
import { ZButton, ZStack, ZText, ZVirtualList } from '@zelviora/angular';
import { contactLabel, controlledDemo, initialRange, inRange, itemKey, valueStatus } from '../data';

/** The app holds the listbox `value` (`zSelect`) and scrolls from outside with `scrollToIndex` / `scrollToKey`. */
@Component({
  selector: 'demo-virtual-list-controlled',
  imports: [ZButton, ZStack, ZText, ZVirtualList],
  template: `
    <z-stack gap="sm">
      <z-stack orientation="horizontal" gap="sm" [wrap]="true">
        <z-button size="sm" variant="outline" tone="neutral" (click)="first()">{{ demo.first }}</z-button>
        <z-button size="sm" variant="outline" tone="neutral" (click)="showSelected()">{{ demo.showSelected }}</z-button>
        <z-button size="sm" variant="outline" tone="neutral" (click)="last()">{{ demo.last }}</z-button>
        <z-button size="sm" variant="outline" tone="neutral" (click)="value.set(demo.pick)">{{ demo.select }}</z-button>
      </z-stack>
      <z-virtual-list
        class="demo-virtual-list"
        listRole="listbox"
        [label]="demo.label"
        [items]="demo.items"
        [getItemKey]="key"
        [formatLabel]="contactLabel"
        [value]="value()"
        (zSelect)="value.set($event.detail.value)"
        (zRangeChange)="range.set($event.detail)"
      >
        @for (c of visible(); track c.key) {
          <div [attr.slot]="'item-' + c.key" class="demo-virtual-row">{{ c.name }}</div>
        }
      </z-virtual-list>
      <z-text variant="muted" size="sm">{{ status() }}</z-text>
    </z-stack>
  `,
})
export class VirtualListControlled {
  readonly demo = controlledDemo;
  readonly key = itemKey;
  readonly contactLabel = contactLabel;
  readonly value = signal<string | undefined>(controlledDemo.value);
  readonly range = signal<ZVirtualListRangeChangeDetail>(initialRange);
  readonly visible = computed(() => inRange(this.demo.items, this.range()));
  readonly status = computed(() => valueStatus(this.value()));
  protected readonly list = viewChild.required(ZVirtualList);

  first() {
    void this.list().scrollToIndex(0, { align: 'start' });
  }

  showSelected() {
    const v = this.value();
    if (v) void this.list().scrollToKey(v, { align: 'center' });
  }

  last() {
    void this.list().scrollToIndex(this.demo.items.length - 1, { align: 'end' });
  }
}

```

### Case: default

#### Angular
```typescript
import { Component, computed, signal } from '@angular/core';
import type { ZVirtualListRangeChangeDetail } from '@zelviora/core';
import { ZVirtualList } from '@zelviora/angular';
import { defaultDemo, initialRange, inRange, itemKey } from '../data';

/**
 * Slot mode: the list only positions items; the app renders light-DOM children `slot="item-<key>"` for the range
 * reported by `zRangeChange` (overscan and the focused item included).
 */
@Component({
  selector: 'demo-virtual-list-default',
  imports: [ZVirtualList],
  template: `
    <z-virtual-list class="demo-virtual-list" [label]="demo.label" [items]="demo.items" [getItemKey]="key" (zRangeChange)="range.set($event.detail)">
      @for (c of visible(); track c.key) {
        <div [attr.slot]="'item-' + c.key" class="demo-virtual-row">{{ demo.row(c) }}</div>
      }
    </z-virtual-list>
  `,
})
export class VirtualListDefault {
  readonly demo = defaultDemo;
  readonly key = itemKey;
  readonly range = signal<ZVirtualListRangeChangeDetail>(initialRange);
  readonly visible = computed(() => inRange(this.demo.items, this.range()));
}

```

### Case: grouped

#### Angular
```typescript
import { Component, computed, signal } from '@angular/core';
import type { ZVirtualListRangeChangeDetail } from '@zelviora/core';
import { ZVirtualList } from '@zelviora/angular';
import { groupedDemo, initialRange, inRange, itemKey } from '../data';

/** A–Z directory: `groups` (data, sorted by `start`) render sticky group headers labelled by their letter. */
@Component({
  selector: 'demo-virtual-list-grouped',
  imports: [ZVirtualList],
  template: `
    <z-virtual-list
      class="demo-virtual-list"
      [label]="demo.label"
      [items]="demo.items"
      [groups]="demo.groups"
      [getItemKey]="key"
      (zRangeChange)="range.set($event.detail)"
    >
      @for (c of visible(); track c.key) {
        <div [attr.slot]="'item-' + c.key" class="demo-virtual-row">{{ c.name }}</div>
      }
    </z-virtual-list>
  `,
})
export class VirtualListGrouped {
  readonly demo = groupedDemo;
  readonly key = itemKey;
  readonly range = signal<ZVirtualListRangeChangeDetail>(initialRange);
  readonly visible = computed(() => inRange(this.demo.items, this.range()));
}

```

### Case: load-more

#### Angular
```typescript
import { Component, DestroyRef, computed, inject, signal } from '@angular/core';
import type { ZVirtualListRangeChangeDetail } from '@zelviora/core';
import { ZSpinner, ZText, ZVirtualList } from '@zelviora/angular';
import { initialRange, inRange, itemKey, loadMoreDemo, makePosts, nextPage, type Post } from '../data';

/** Infinite loading: `loadMore` while data remains, `zLoadMore` near the end, `loading` while the next page arrives. */
@Component({
  selector: 'demo-virtual-list-load-more',
  imports: [ZSpinner, ZText, ZVirtualList],
  template: `
    <z-virtual-list
      class="demo-virtual-list"
      [label]="demo.label"
      [items]="items()"
      [getItemKey]="key"
      [loading]="loading()"
      [loadMore]="items().length < demo.total"
      (zLoadMore)="more()"
      (zRangeChange)="range.set($event.detail)"
    >
      @for (p of visible(); track p.key) {
        <div [attr.slot]="'item-' + p.key" class="demo-virtual-row">{{ p.title }}</div>
      }
      <z-spinner slot="loading" [label]="demo.loading"></z-spinner>
      <z-text slot="empty" variant="muted">{{ demo.empty }}</z-text>
    </z-virtual-list>
  `,
})
export class VirtualListLoadMore {
  readonly demo = loadMoreDemo;
  readonly key = itemKey;
  readonly items = signal<Post[]>(makePosts(loadMoreDemo.page));
  readonly loading = signal(false);
  readonly range = signal<ZVirtualListRangeChangeDetail>(initialRange);
  readonly visible = computed(() => inRange(this.items(), this.range()));
  private timer: ReturnType<typeof setTimeout> | undefined;

  constructor() {
    inject(DestroyRef).onDestroy(() => clearTimeout(this.timer));
  }

  more() {
    this.loading.set(true);
    this.timer = setTimeout(() => {
      this.items.update(nextPage);
      this.loading.set(false);
    }, loadMoreDemo.delay);
  }
}

```

### Case: variants

#### Angular
```typescript
import { Component, computed, signal } from '@angular/core';
import type { ZVirtualListRangeChangeDetail } from '@zelviora/core';
import { ZGrid, ZStack, ZText, ZVirtualList } from '@zelviora/angular';
import { contactLabel, initialRange, inRange, itemKey, postLabel, variantsDemo } from '../data';

/** `listRole` feed (APG Feed: PageDown / PageUp move between articles) and listbox (single selection, typeahead). */
@Component({
  selector: 'demo-virtual-list-variants',
  imports: [ZGrid, ZStack, ZText, ZVirtualList],
  template: `
    <z-grid columns="1 sm:2" gap="lg">
      <z-virtual-list
        class="demo-virtual-list"
        listRole="feed"
        [dynamicSize]="true"
        [label]="feed.label"
        [items]="feed.items"
        [getItemKey]="key"
        [formatLabel]="postLabel"
        (zRangeChange)="feedRange.set($event.detail)"
      >
        @for (p of feedVisible(); track p.key) {
          <div [attr.slot]="'item-' + p.key" class="demo-virtual-row">
            <z-stack gap="xs">
              <z-text variant="strong" data-z-item-label="">{{ p.title }}</z-text>
              <z-text variant="muted" size="sm" data-z-item-description="">{{ p.body }}</z-text>
            </z-stack>
          </div>
        }
      </z-virtual-list>
      <z-virtual-list
        class="demo-virtual-list"
        listRole="listbox"
        [label]="listbox.label"
        [items]="listbox.items"
        [getItemKey]="key"
        [formatLabel]="contactLabel"
        (zRangeChange)="boxRange.set($event.detail)"
      >
        @for (c of boxVisible(); track c.key) {
          <div [attr.slot]="'item-' + c.key" class="demo-virtual-row">{{ c.name }}</div>
        }
      </z-virtual-list>
    </z-grid>
  `,
})
export class VirtualListVariants {
  readonly feed = variantsDemo.feed;
  readonly listbox = variantsDemo.listbox;
  readonly key = itemKey;
  readonly postLabel = postLabel;
  readonly contactLabel = contactLabel;
  readonly feedRange = signal<ZVirtualListRangeChangeDetail>(variantsDemo.feed.initialRange);
  readonly boxRange = signal<ZVirtualListRangeChangeDetail>(initialRange);
  readonly feedVisible = computed(() => inRange(this.feed.items, this.feedRange()));
  readonly boxVisible = computed(() => inRange(this.listbox.items, this.boxRange()));
}

```


================================================================================
# COMPONENT: WATERMARK
================================================================================

## Documentation

# watermark — Angular

Processed requirements of [`<z-watermark>`](../../../../../requirements/04-components/data-display/watermark.md) for Angular (`@zelviora/angular`).

## Usage

```html
<z-watermark [text]="['Confidential', 'anna.lee']">
  <p>Report</p>
</z-watermark>
```

## Binding

No model event. `text` (string or array), `image` (data URL or Blob) and `tileGap` are set as properties. A client-side watermark is a deterrent: anything the browser draws can be removed; protect sensitive data on the server. Search keyword: "Watermark" (antd `Watermark`).

## Events

| Output | Detail | Notes |
|---|---|---|
| `(zTamper)` | `{ reason: 'removed' \| 'style-changed' }` | Only with `protect`; not cancelable |

## Demo mapping

| `type` | File | Spec case |
|---|---|---|
| `basic` | `watermark-basic.ts` | D-1 Default, D-12 Dark |
| `variants` | `watermark-variants.ts` | D-3 Variants |
| `protect` | `watermark-protect.ts` | D-6 States |
| `controlled` | `watermark-controlled.ts` | D-9 Controlled, D-19 i18n |
| `form` | `watermark-form.ts` | D-10 In form, D-15 Keyboard-only |
| `table` | `watermark-table.ts` | D-17 Composition, D-18 Customization |

## Customization

The `table` demo uses this rule of the demo stylesheet:

```css
.demo-watermark-brand {
  --z-watermark-color: var(--z-color-primary-text);
  --z-watermark-opacity: var(--z-opacity-10);
}
```


## Examples & Implementation

### Case: basic

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCard, ZWatermark } from '@zelviora/angular';

@Component({
  selector: 'demo-watermark-basic',
  imports: [ZCard, ZWatermark],
  template: `
    <z-watermark text="Confidential">
      <z-card heading="Q3 forecast" description="Internal">
        <p>Revenue is expected to grow 12% compared with Q2. Hiring stays flat until January.</p>
        <p>Do not share outside the finance team.</p>
      </z-card>
    </z-watermark>
  `,
})
export class WatermarkBasic {}

```

### Case: controlled

#### Angular
```typescript
import { Component, computed, signal } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { TextValueAccessor, ZCard, ZInput, ZStack, ZWatermark } from '@zelviora/angular';

// The app formats the date for the locale.
const today = new Intl.DateTimeFormat('en-US', { dateStyle: 'short' }).format(new Date());

@Component({
  selector: 'demo-watermark-controlled',
  imports: [FormsModule, TextValueAccessor, ZCard, ZInput, ZStack, ZWatermark],
  template: `
    <z-stack gap="sm">
      <z-input class="demo-narrow" label="User" [ngModel]="user()" (ngModelChange)="user.set($event)"></z-input>
      <z-watermark [text]="lines()">
        <z-card heading="Payroll"><p>The watermark follows the user name.</p><p>October payroll.</p></z-card>
      </z-watermark>
    </z-stack>
  `,
})
export class WatermarkControlled {
  readonly user = signal('anna.lee');
  readonly lines = computed(() => [this.user() || '—', today]);
}

```

### Case: form

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZButton, ZField, ZInput, ZStack, ZWatermark } from '@zelviora/angular';

@Component({
  selector: 'demo-watermark-form',
  imports: [ZButton, ZField, ZInput, ZStack, ZWatermark],
  template: `
    <z-watermark text="Draft">
      <form class="demo-narrow">
        <z-stack>
          <z-field label="Title">
            <z-input name="title"></z-input>
          </z-field>
          <z-field label="Amount">
            <z-input name="amount"></z-input>
          </z-field>
          <z-button type="button">Save draft</z-button>
        </z-stack>
      </form>
    </z-watermark>
  `,
})
export class WatermarkForm {}

```

### Case: protect

#### Angular
```typescript
import { Component, signal } from '@angular/core';
import { ZCard, ZStack, ZWatermark } from '@zelviora/angular';

@Component({
  selector: 'demo-watermark-protect',
  imports: [ZCard, ZStack, ZWatermark],
  template: `
    <z-stack gap="sm">
      <z-watermark [protect]="true" text="Internal use only" (zTamper)="onTamper($event.detail.reason)">
        <z-card heading="Protected">
          <p>Remove the layer in DevTools: it comes back and zTamper fires. This deters, it does not secure.</p>
        </z-card>
      </z-watermark>
      <span>Tamper events: {{ log().length ? log().join(', ') : 'none' }}</span>
    </z-stack>
  `,
})
export class WatermarkProtect {
  readonly log = signal<string[]>([]);

  onTamper(reason: string) {
    this.log.update((l) => [...l, reason]);
  }
}

```

### Case: table

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZTable, ZWatermark } from '@zelviora/angular';

@Component({
  selector: 'demo-watermark-table',
  imports: [ZTable, ZWatermark],
  template: `
    <z-watermark text="Confidential – HR" class="demo-watermark-brand">
      <z-table caption="Salaries" rowHeader="name" [columns]="columns" [rows]="rows"></z-table>
    </z-watermark>
  `,
})
export class WatermarkTable {
  readonly columns = [
    { key: 'name', header: 'Employee' },
    { key: 'salary', header: 'Salary', format: { type: 'currency' as const, currency: 'USD' } },
  ];
  readonly rows = [
    { key: '1', name: 'Anna Lee', salary: 85000 },
    { key: '2', name: 'Mark Tran', salary: 102000 },
    { key: '3', name: 'Carlos Diaz', salary: 64500 },
  ];
}

```

### Case: variants

#### Angular
```typescript
import { Component } from '@angular/core';
import { ZCard, ZGrid, ZWatermark } from '@zelviora/angular';

@Component({
  selector: 'demo-watermark-variants',
  imports: [ZCard, ZGrid, ZWatermark],
  template: `
    <z-grid columns="1 md:2" gap="md">
      <z-watermark [text]="lines" [rotate]="-30" [tileGap]="gap">
        <z-card heading="Several lines"><p>Name, user and date on each tile.</p><p>Rotated by -30°.</p></z-card>
      </z-watermark>
      <z-watermark [image]="logo">
        <z-card heading="Image"><p>An embedded logo repeated over the content.</p><p>No network request.</p></z-card>
      </z-watermark>
    </z-grid>
  `,
})
export class WatermarkVariants {
  // An image must be a data URL (or a Blob loaded by the app): the watermark never fetches.
  readonly logo = "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='64'%3E%3Crect x='4' y='4' width='112' height='56' rx='12' fill='none' stroke='%23888' stroke-width='4'/%3E%3Ctext x='60' y='40' font-size='20' text-anchor='middle' fill='%23888' font-family='sans-serif'%3EACME%3C/text%3E%3C/svg%3E";
  readonly lines = ['Confidential', 'anna.lee', '05/10/2026'];
  readonly gap: [number, number] = [60, 60];
}

```

