# Zelviora Component Library — LLM Documentation (React)

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

#### React
```tsx
import { ZAccordion, ZAccordionContent, ZAccordionItem, ZAccordionTrigger } from '@zelviora/react';

export function AccordionDefault() {
  return (
    <ZAccordion defaultValue="shipping">
      <ZAccordionItem value="shipping">
        <ZAccordionTrigger>How long does shipping take?</ZAccordionTrigger>
        <ZAccordionContent>Orders arrive in 2–3 business days.</ZAccordionContent>
      </ZAccordionItem>
      <ZAccordionItem value="returns">
        <ZAccordionTrigger>Can I return an item?</ZAccordionTrigger>
        <ZAccordionContent>Yes, within 30 days of delivery.</ZAccordionContent>
      </ZAccordionItem>
      <ZAccordionItem value="warranty">
        <ZAccordionTrigger>Is there a warranty?</ZAccordionTrigger>
        <ZAccordionContent>Every product has a two-year warranty.</ZAccordionContent>
      </ZAccordionItem>
    </ZAccordion>
  );
}

```

### Case: multiple

#### React
```tsx
import { useState } from 'react';
import { ZAccordion, ZAccordionContent, ZAccordionItem, ZAccordionTrigger, ZStack } from '@zelviora/react';

export function AccordionMultiple() {
  const [open, setOpen] = useState<string[]>(['general']);
  return (
    <ZStack>
      <ZAccordion multiple variant="outline" value={open} onZChange={(e) => setOpen(e.detail.value as string[])}>
        <ZAccordionItem value="general">
          <ZAccordionTrigger>General</ZAccordionTrigger>
          <ZAccordionContent>Language and time zone.</ZAccordionContent>
        </ZAccordionItem>
        <ZAccordionItem value="privacy">
          <ZAccordionTrigger>Privacy</ZAccordionTrigger>
          <ZAccordionContent>Who can see your profile.</ZAccordionContent>
        </ZAccordionItem>
        <ZAccordionItem value="beta" disabled>
          <ZAccordionTrigger>Beta features</ZAccordionTrigger>
          <ZAccordionContent>Not available on your plan.</ZAccordionContent>
        </ZAccordionItem>
      </ZAccordion>
      <p>Open: {open.join(', ') || 'none'}</p>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZAffix, ZButton, ZCard, ZStack, ZText } from '@zelviora/react';

export function AffixBasic() {
  return (
    <div className="demo-scroll-frame">
      <ZStack gap="md">
        <ZText>Scroll down: the toolbar sticks.</ZText>
        <ZAffix topOffset="8px">
          <ZCard size="sm"><ZStack orientation="horizontal" gap="sm"><ZButton size="sm">Bold</ZButton><ZButton size="sm" variant="outline">Italic</ZButton></ZStack></ZCard>
        </ZAffix>
        <div className="demo-long"></div>
      </ZStack>
    </div>
  );
}

```

### Case: bottom

#### React
```tsx
import { ZAffix, ZButton, ZCard, ZStack } from '@zelviora/react';

export function AffixBottom() {
  return (
    <div className="demo-scroll-frame">
      <ZStack gap="md">
        <div className="demo-long"></div>
        <ZAffix bottomOffset="0">
          <ZCard size="sm"><ZStack orientation="horizontal" gap="sm" justify="end"><ZButton size="sm" variant="outline" tone="neutral">Cancel</ZButton><ZButton size="sm">Save</ZButton></ZStack></ZCard>
        </ZAffix>
      </ZStack>
    </div>
  );
}

```

### Case: customization

#### React
```tsx
import { ZAffix, ZCard, ZStack, ZText } from '@zelviora/react';

export function AffixCustomization() {
  return (
    <div className="demo-scroll-frame">
      <ZStack gap="md">
        <ZText>Scroll down to see the shadow.</ZText>
        <ZAffix className="demo-affix-shadow">
          <ZCard size="sm"><ZText>Table of contents</ZText></ZCard>
        </ZAffix>
        <div className="demo-long"></div>
      </ZStack>
    </div>
  );
}

```


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

#### React
```tsx
import { ZAlert } from '@zelviora/react';

export function AlertBasic() {
  return <ZAlert heading="Scheduled maintenance">The service will be unavailable on Sunday from 1:00 to 3:00.</ZAlert>;
}

```

### Case: dismissible

#### React
```tsx
import { useState } from 'react';
import { ZAlert, ZButton, ZStack } from '@zelviora/react';

export function AlertDismissible() {
  const [open, setOpen] = useState(true);
  return (
    <ZStack gap="md" alignItems="start">
      <ZAlert tone="info" dismissible open={open} onZOpenChange={(e) => setOpen(e.detail.open)}>
        A new version is available.
        <ZButton slot="actions" size="sm" variant="outline" tone="neutral">Update now</ZButton>
      </ZAlert>
      {!open && <ZButton variant="link" onClick={() => setOpen(true)}>Show the alert again</ZButton>}
    </ZStack>
  );
}

```

### Case: live

#### React
```tsx
import { useState } from 'react';
import { ZAlert, ZButton, ZStack } from '@zelviora/react';

export function AlertLive() {
  const [error, setError] = useState(false);
  return (
    <ZStack gap="md" alignItems="start">
      <ZButton onClick={() => setError(true)}>Upload file</ZButton>
      {error && (
        <ZAlert tone="destructive" live="assertive" heading="Upload failed">
          The file is larger than 10 MB.
        </ZAlert>
      )}
    </ZStack>
  );
}

```

### Case: tones

#### React
```tsx
import { ZAlert, ZStack } from '@zelviora/react';

export function AlertTones() {
  return (
    <ZStack gap="md">
      <ZAlert tone="success">Your changes were saved.</ZAlert>
      <ZAlert tone="warning" variant="outline" heading="Storage almost full">You have used 90% of your storage.</ZAlert>
      <ZAlert tone="destructive" variant="solid">The payment could not be processed.</ZAlert>
      <ZAlert tone="neutral">Drafts are kept for 30 days.</ZAlert>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZAlertDialog, ZButton } from '@zelviora/react';

/** Keeps the dialog open while a (fake) request runs: preventDefault() on confirm, then close from state. */
export function AlertDialogAsync() {
  const [open, setOpen] = useState(false);
  const [loading, setLoading] = useState(false);

  return (
    <ZAlertDialog
      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}
      onZOpenChange={(e) => setOpen(e.detail.open)}
      onZConfirm={(e) => {
        e.preventDefault();
        setLoading(true);
        setTimeout(() => {
          setLoading(false);
          setOpen(false);
        }, 1000);
      }}
      onZCancel={() => setLoading(false)}
    >
      <ZButton slot="trigger" variant="outline" tone="warning">
        Leave workspace
      </ZButton>
    </ZAlertDialog>
  );
}

```

### Case: default

#### React
```tsx
import { useState } from 'react';
import { ZAlertDialog, ZButton, ZStack } from '@zelviora/react';

export function AlertDialogDefault() {
  const [result, setResult] = useState('none yet');
  return (
    <ZStack gap="sm">
      <ZAlertDialog
        heading="Delete project?"
        description="The project and its 24 files are deleted permanently. This cannot be undone."
        actionLabel="Delete"
        onZConfirm={() => setResult('deleted')}
        onZCancel={(e) => setResult(`kept (${e.detail.reason})`)}
      >
        <ZButton slot="trigger" tone="destructive">
          Delete project
        </ZButton>
      </ZAlertDialog>
      <span>Result: {result}</span>
    </ZStack>
  );
}

```

### Case: imperative

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZStack, confirm } from '@zelviora/react';

/** confirm() opens an alert dialog from code and resolves true (confirmed) or false (cancelled / Escape). */
export function AlertDialogImperative() {
  const [result, setResult] = useState('No answer yet');

  async function 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',
    });
    setResult(ok ? 'Deleted' : 'Kept');
  }

  return (
    <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
      <ZButton tone="destructive" onClick={remove}>
        Delete project
      </ZButton>
      <span role="status">{result}</span>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZAnchor, ZAnchorLink, ZHeading, ZStack, ZText } from '@zelviora/react';

const parts = ['Overview', 'Install', 'Usage', 'Theming', 'FAQ'];

/** Five sections in a scroll container (`target`); the link of the section being read is marked while scrolling. */
export function AnchorDefault() {
  const [scroller, setScroller] = useState<HTMLDivElement | null>(null);
  const [last, setLast] = useState('');
  return (
    <ZStack gap="sm">
      <ZStack orientation="horizontal" gap="md">
        <ZAnchor className="demo-anchor-toc" target={scroller ?? undefined} onZChange={(e) => setLast(`${e.detail.value} (${e.detail.reason})`)}>
          {parts.map((p) => (
            <ZAnchorLink key={p} href={`#react-anchor-${p.toLowerCase()}`}>{p}</ZAnchorLink>
          ))}
        </ZAnchor>
        <div ref={setScroller} className="demo-anchor-scroll" tabIndex={0}>
          {parts.map((p) => (
            <section key={p} id={`react-anchor-${p.toLowerCase()}`} className="demo-anchor-section">
              <ZHeading level={3}>{p}</ZHeading>
              <ZText as="p">Scroll this box or use the links: the table of contents follows the section being read.</ZText>
            </section>
          ))}
        </div>
      </ZStack>
      <span>{`zChange: ${last || 'none yet'}`}</span>
    </ZStack>
  );
}

```

### Case: nested

#### React
```tsx
import { useState } from 'react';
import { ZAnchor, ZAnchorLink, ZHeading, ZStack, ZText } from '@zelviora/react';

/** Two levels (`sub` slot), long labels, smooth scrolling and an `offset` for the sticky header of the container. */
export function AnchorNested() {
  const [scroller, setScroller] = useState<HTMLDivElement | null>(null);
  return (
    <ZStack orientation="horizontal" gap="md">
      <ZAnchor className="demo-anchor-toc" label="Guide" target={scroller ?? undefined} offset={48} smooth>
        <ZAnchorLink href="#react-guide-start">Getting started</ZAnchorLink>
        <ZAnchorLink href="#react-guide-config">
          Configuration
          <ZAnchorLink slot="sub" href="#react-guide-tokens">Design tokens and brand themes for every product</ZAnchorLink>
          <ZAnchorLink slot="sub" href="#react-guide-locale">Locale</ZAnchorLink>
        </ZAnchorLink>
        <ZAnchorLink href="#react-guide-deploy">Deploy</ZAnchorLink>
      </ZAnchor>
      <div ref={setScroller} className="demo-anchor-scroll" tabIndex={0}>
        <div className="demo-anchor-sticky"><ZText>Sticky header (offset 48)</ZText></div>
        <section id="react-guide-start" className="demo-anchor-section"><ZHeading level={3}>Getting started</ZHeading></section>
        <section id="react-guide-config" className="demo-anchor-section"><ZHeading level={3}>Configuration</ZHeading></section>
        <section id="react-guide-tokens" className="demo-anchor-section"><ZHeading level={4}>Design tokens</ZHeading></section>
        <section id="react-guide-locale" className="demo-anchor-section"><ZHeading level={4}>Locale</ZHeading></section>
        <section id="react-guide-deploy" className="demo-anchor-section"><ZHeading level={3}>Deploy</ZHeading></section>
      </div>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZAppShell, ZIcon, ZSegmented, ZSegmentedItem, ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack, ZText } from '@zelviora/react';
import { docsNavLabel, docsTitle, itemHref, sectionItems, sectionsLabel, texts } from '../data.ts';

/** `collapseMode` icon (an icon strip stays) or offcanvas (the column hides); the navigation sits at the end. */
export function AppShellCollapseMode() {
  const [mode, setMode] = useState<'icon' | 'offcanvas'>('icon');
  return (
    <ZStack gap="sm">
      <ZSegmented label={texts.collapseModeLabel} value={mode} onZChange={(e) => setMode(e.detail.value as 'icon' | 'offcanvas')}>
        <ZSegmentedItem value="icon">Icon</ZSegmentedItem>
        <ZSegmentedItem value="offcanvas">Offcanvas</ZSegmentedItem>
      </ZSegmented>
      <div className="demo-app-shell-scroll">
        <ZAppShell className="demo-app-shell-frame demo-app-shell-wide" breakpoint="sm" side="end" collapseMode={mode} disableStickyHeader>
          <ZText slot="header" variant="strong">{docsTitle}</ZText>
          <ZSidebar slot="nav" label={docsNavLabel}>
            <ZSidebarGroup label={sectionsLabel}>
              {sectionItems.map((item, i) => (
                <ZSidebarItem key={item.value} href={itemHref('collapse-mode', item.value)} current={i === 0}>
                  <ZIcon slot="icon" name={item.icon} />
                  {item.label}
                </ZSidebarItem>
              ))}
            </ZSidebarGroup>
          </ZSidebar>
          <ZText>{texts.collapseModeHint(mode)}</ZText>
        </ZAppShell>
      </div>
    </ZStack>
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZAppShell, ZButton, ZIcon, ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack, ZText } from '@zelviora/react';
import { itemHref, navLabel, shellTitle, texts, workspaceItems, workspaceLabel } from '../data.ts';

/** The app holds `navCollapsed` (wide mode) and updates it on `zCollapseChange` (no `hotkey`, so no shortcut). */
export function AppShellControlled() {
  const [navCollapsed, setNavCollapsed] = useState(false);
  return (
    <ZStack gap="sm">
      <ZStack orientation="horizontal" alignItems="center" gap="sm">
        <ZButton size="sm" variant="outline" tone="neutral" onClick={() => setNavCollapsed((c) => !c)}>
          {navCollapsed ? texts.expand : texts.collapse}
        </ZButton>
        <ZText variant="muted" size="sm">navCollapsed = {String(navCollapsed)}</ZText>
      </ZStack>
      <div className="demo-app-shell-scroll">
        <ZAppShell
          className="demo-app-shell-frame demo-app-shell-wide"
          breakpoint="sm"
          disableStickyHeader
          navCollapsed={navCollapsed}
          onZCollapseChange={(e) => setNavCollapsed(e.detail.navCollapsed)}
        >
          <ZText slot="header" variant="strong">{shellTitle}</ZText>
          <ZSidebar slot="nav" label={navLabel}>
            <ZSidebarGroup label={workspaceLabel}>
              {workspaceItems.map((item, i) => (
                <ZSidebarItem key={item.value} href={itemHref('controlled', item.value)} current={i === 0}>
                  <ZIcon slot="icon" name={item.icon} />
                  {item.label}
                </ZSidebarItem>
              ))}
            </ZSidebarGroup>
          </ZSidebar>
          <ZText>{texts.controlledHint}</ZText>
        </ZAppShell>
      </div>
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { ZAppShell, ZBadge, ZIcon, ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack, ZText } from '@zelviora/react';
import { footer, itemHref, navLabel, orderLine, recentOrders, recentOrdersTitle, shellTitle, workspaceItems, workspaceLabel } from '../data.ts';

/** Wide mode with the navigation open; the header stays on top while the content scrolls. `hotkey="Mod+B"`: Ctrl+B (⌘B) collapses it. */
export function AppShellDefault() {
  return (
    <div className="demo-app-shell-scroll">
      <ZAppShell className="demo-app-shell-frame demo-app-shell-wide" breakpoint="sm" navLabel="Main" hotkey="Mod+B">
        <ZText slot="header" variant="strong">{shellTitle}</ZText>
        <ZSidebar slot="nav" label={navLabel}>
          <ZSidebarGroup label={workspaceLabel}>
            {workspaceItems.map((item, i) => (
              <ZSidebarItem key={item.value} href={itemHref('default', item.value)} current={i === 0}>
                <ZIcon slot="icon" name={item.icon} />
                {item.label}
                {item.badge && <ZBadge slot="end">{item.badge}</ZBadge>}
              </ZSidebarItem>
            ))}
          </ZSidebarGroup>
        </ZSidebar>
        <ZStack gap="sm">
          <ZText variant="strong">{recentOrdersTitle}</ZText>
          {recentOrders.map((o) => <ZText key={o.id}>{orderLine(o)}</ZText>)}
        </ZStack>
        <ZText slot="footer" variant="muted" size="sm">{footer}</ZText>
      </ZAppShell>
    </div>
  );
}

```

### Case: narrow

#### React
```tsx
import { useState } from 'react';
import { ZAppShell, ZButton, ZIcon, ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack, ZText } from '@zelviora/react';
import { itemHref, narrowItems, navLabel, texts, workspaceLabel } from '../data.ts';

/**
 * 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`.
 */
export function AppShellNarrow() {
  const [navOpen, setNavOpen] = useState(false);
  const [mode, setMode] = useState('-');
  const [reason, setReason] = useState('-');
  return (
    <ZAppShell
      className="demo-app-shell-frame"
      breakpoint="xl"
      navOpen={navOpen}
      onZOpenChange={(e) => { setNavOpen(e.detail.navOpen); setReason(e.detail.reason); }}
      onZModeChange={(e) => setMode(e.detail.mode)}
    >
      <ZText slot="header" variant="strong">{texts.narrowTitle}</ZText>
      <ZSidebar slot="nav" label={navLabel}>
        <ZSidebarGroup label={workspaceLabel}>
          {narrowItems.map((item, i) => (
            <ZSidebarItem key={item.value} href={itemHref('narrow', item.value)} current={i === 0}>
              <ZIcon slot="icon" name={item.icon} />
              {item.label}
            </ZSidebarItem>
          ))}
        </ZSidebarGroup>
      </ZSidebar>
      <ZStack gap="sm" alignItems="start">
        <ZButton size="sm" variant="outline" tone="neutral" disabled={mode !== 'narrow'} onClick={() => setNavOpen(true)}>{texts.openNav}</ZButton>
        <ZText variant="muted" size="sm">mode = {mode}, navOpen = {String(navOpen)}, last reason = {reason}</ZText>
      </ZStack>
    </ZAppShell>
  );
}

```


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

#### React
```tsx
import { ZAreaChart } from '@zelviora/react-chart';
import { bandwidthData, bandwidthSeries } from '../data.ts';

export function AreaChartBasic() {
  return (
    <ZAreaChart
      heading="Cluster Network Throughput (Gbps)"
      description="Inbound and outbound traffic volume sampled across six intervals."
      xKey="window" data={bandwidthData} series={bandwidthSeries}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/react';
import { ZAreaChart } from '@zelviora/react-chart';
import { bandwidthData, bandwidthSeries } from '../data.ts';

export function AreaChartControlled() {
  const [hidden, setHidden] = useState<string[]>([]);
  const [selected, setSelected] = useState<string>('Click any chart element to inspect');

  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <ZButton
          size="sm"
          variant="outline"
          onClick={() => setHidden([])}
        >
          Show All Series
        </ZButton>
        <ZBadge tone="primary" variant="soft">
          {selected}
        </ZBadge>
        <ZText variant="muted" size="sm">
          Hidden: {hidden.length ? hidden.join(', ') : 'none'}
        </ZText>
      </ZStack>
      <ZAreaChart
        heading="Cluster Network Throughput (Gbps) (Interactive)"
        description="Inbound and outbound traffic volume sampled across six intervals."
        xKey="window" data={bandwidthData} series={bandwidthSeries}
        selectable
        hiddenSeries={hidden}
        onZSeriesToggle={(e) => setHidden(e.detail.hiddenSeries)}
        onZPointSelect={(e) =>
          setSelected(`Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`)
        }
      />
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZAreaChart } from '@zelviora/react-chart';
import { bandwidthData, bandwidthSeries } from '../data.ts';

export function AreaChartCustomization() {
  return (
    <ZAreaChart
      className="demo-chart-brand"
      description="Inbound and outbound traffic volume sampled across six intervals."
      valueFormat={{ maximumFractionDigits: 1 }}
      xKey="window" data={bandwidthData} series={bandwidthSeries} stacked dataZoom areaOpacity={0.28} renderer="canvas"
    >
      <span slot="heading">Cluster Network Throughput (Gbps) — Custom Theme Tokens &amp; Canvas</span>
    </ZAreaChart>
  );
}

```

### Case: states

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZAreaChart } from '@zelviora/react-chart';
import { bandwidthData, bandwidthSeries } from '../data.ts';

export function AreaChartStates() {
  return (
    <ZStack gap="lg">
      <ZAreaChart
        heading="Loading State (aria-busy)"
        loading
        xKey="window" data={bandwidthData} series={bandwidthSeries}
      />
      <ZAreaChart
        heading="Empty State"
        data={[]}
        series={bandwidthSeries}
      />
      <ZAreaChart
        heading="Expanded Accessible Data Table"
        description="Inbound and outbound traffic volume sampled across six intervals."
        showDataTable
        xKey="window" data={bandwidthData} series={bandwidthSeries}
      />
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZAreaChart } from '@zelviora/react-chart';
import { bandwidthData, bandwidthSeries } from '../data.ts';

export function AreaChartVariants() {
  return (
    <ZStack gap="lg">
      <ZAreaChart
        heading="Stacked Cumulative Area"
        description="Stacked cumulative area chart with higher fill opacity vs unstacked clean area without symbols."
        xKey="window" data={bandwidthData} series={bandwidthSeries} stacked smooth areaOpacity={0.35}
      />
      <ZAreaChart
        heading="Subtle Unstacked Fill"
        description="Stacked cumulative area chart with higher fill opacity vs unstacked clean area without symbols."
        xKey="window" data={bandwidthData} series={bandwidthSeries} areaOpacity={0.12} showSymbol={false}
      />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZAspectRatio } from '@zelviora/react';

export function AspectRatioBasic() {
  return (
    <ZAspectRatio 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" />
    </ZAspectRatio>
  );
}

```

### Case: composition

#### React
```tsx
import { ZAspectRatio, ZCard } from '@zelviora/react';

export function AspectRatioComposition() {
  return (
    <ZCard heading="Head office" description="12 Le Loi, District 1" className="demo-narrow">
      <ZAspectRatio ratio="4/3" className="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" /></ZAspectRatio>
    </ZCard>
  );
}

```

### Case: fit

#### React
```tsx
import { ZAspectRatio, ZGrid } from '@zelviora/react';

export function AspectRatioFit() {
  return (
    <ZGrid columns="3" gap="md">
      <ZAspectRatio 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" /></ZAspectRatio>
      <ZAspectRatio 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" /></ZAspectRatio>
      <ZAspectRatio 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" /></ZAspectRatio>
    </ZGrid>
  );
}

```

### Case: ratios

#### React
```tsx
import { ZAspectRatio, ZGrid } from '@zelviora/react';

export function AspectRatioRatios() {
  return (
    <ZGrid columns="2" gap="md">
      <ZAspectRatio ratio="1/1"><div className="demo-media">1/1</div></ZAspectRatio>
      <ZAspectRatio ratio="4:3"><div className="demo-media">4:3</div></ZAspectRatio>
      <ZAspectRatio ratio="21/9"><div className="demo-media">21/9</div></ZAspectRatio>
      <ZAspectRatio ratio="1.5"><div className="demo-media">1.5</div></ZAspectRatio>
    </ZGrid>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZAutocomplete, ZStack } from '@zelviora/react';

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

/** Free text with suggestions computed from the typed text: the value is the text. */
export function AutocompleteDefault() {
  const [email, setEmail] = useState('');
  const local = email.split('@')[0] ?? '';
  const options = local ? DOMAINS.map((d) => ({ value: `${local}@${d}`, label: `${local}@${d}` })) : [];
  return (
    <ZStack className="demo-narrow">
      <ZAutocomplete label="Email" type="email" placeholder="name@example.com" clearable value={email} options={options} onZInput={(e) => setEmail(e.detail.value)} />
      <span>Value: {email || '(empty)'}</span>
    </ZStack>
  );
}

```

### Case: form

#### React
```tsx
import { useState } from 'react';
import { ZAutocomplete, ZButton, ZField, ZSelectOption, ZStack } from '@zelviora/react';

/** Native form: the text is submitted; required email inside a field (a bad address shows typeMismatch); reset. */
export function AutocompleteForm() {
  const [sent, setSent] = useState('');
  return (
    <form
      className="demo-narrow"
      onSubmit={(e) => {
        e.preventDefault();
        setSent(JSON.stringify([...new FormData(e.currentTarget).entries()]));
      }}
    >
      <ZStack>
        <ZField label="Email" hint="Required, a valid address" required>
          <ZAutocomplete name="email" type="email" required>
            <ZSelectOption value="an@zelviora.vn">an@zelviora.vn</ZSelectOption>
            <ZSelectOption value="binh@zelviora.vn">binh@zelviora.vn</ZSelectOption>
          </ZAutocomplete>
        </ZField>
        <ZAutocomplete name="city" label="City" defaultValue="Helsinki">
          <ZSelectOption value="Boston">Boston</ZSelectOption>
          <ZSelectOption value="Helsinki">Helsinki</ZSelectOption>
          <ZSelectOption value="Seattle">Seattle</ZSelectOption>
        </ZAutocomplete>
        <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
          <ZButton type="submit">Submit</ZButton>
          <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
        </ZStack>
        {sent && <output>{sent}</output>}
      </ZStack>
    </form>
  );
}

```

### Case: history

#### React
```tsx
import { useState } from 'react';
import { ZAutocomplete, ZStack } from '@zelviora/react';

const HISTORY = [
  { 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; Escape on the closed popup clears it. */
export function AutocompleteHistory() {
  const [query, setQuery] = useState('');
  const [submitted, setSubmitted] = useState('');
  return (
    <ZStack className="demo-narrow">
      <ZAutocomplete label="Search" type="search" clearable minChars={0} options={HISTORY} value={query} onZInput={(e) => setQuery(e.detail.value)} onZChange={(e) => setSubmitted(e.detail.value)} />
      <span>Last committed search: {submitted || '(none)'}</span>
    </ZStack>
  );
}

```

### Case: i18n

#### React
```tsx
import { ZAutocomplete, ZConfigProvider, ZSelectOption } from '@zelviora/react';

const PLACES = ['Đà Lạt', 'Đà Nẵng', 'Hà Nội', 'Hạ Long', 'Huế', 'Hội An', 'Phú Quốc', 'Sa Pa'];

/** With locale `vi` inline completion ignores accents ("da" completes "Đà Lạt") and the built-in texts are Vietnamese. */
export function AutocompleteI18n() {
  return (
    <ZConfigProvider locale="vi">
      <div className="demo-narrow">
        <ZAutocomplete label="Điểm đến" hint='Gõ "h" hoặc "đà"' inlineComplete>
          {PLACES.map((p) => <ZSelectOption key={p} value={p}>{p}</ZSelectOption>)}
        </ZAutocomplete>
      </div>
    </ZConfigProvider>
  );
}

```

### Case: inline

#### React
```tsx
import { ZAutocomplete, ZSelectOption, ZStack } from '@zelviora/react';

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. */
export function AutocompleteInline() {
  return (
    <ZStack className="demo-narrow">
      <ZAutocomplete label="Destination" hint='Type "h" or "da"' inlineComplete>
        {PLACES.map((p) => <ZSelectOption key={p} value={p}>{p}</ZSelectOption>)}
      </ZAutocomplete>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZAvatar, ZStack } from '@zelviora/react';

// 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";

export function AvatarBasic() {
  return (
    <ZStack orientation="horizontal" alignItems="center" gap="md">
      <ZAvatar src={PHOTO} name="Anna Lee" />
      <ZAvatar name="Mark Tran" />
    </ZStack>
  );
}

```

### Case: fallback

#### React
```tsx
import { useState } from 'react';
import { ZAvatar, ZIcon, ZStack, ZText } from '@zelviora/react';

const BROKEN = 'data:image/png;base64,AAAA';

export function AvatarFallback() {
  const [status, setStatus] = useState('loading…');
  return (
    <ZStack gap="sm">
      <ZStack orientation="horizontal" alignItems="center" gap="md" wrap>
        <ZAvatar src={BROKEN} name="Daniel Hughes" onZError={() => setStatus('image failed, initials shown')} onZLoad={() => setStatus('loaded')} />
        <ZAvatar name="👨‍👩‍👧 Family" tone="info" />
        <ZAvatar alt="Guest" />
        <ZAvatar name="Support team">
          <ZIcon slot="fallback" name="person" />
        </ZAvatar>
      </ZStack>
      <ZText variant="muted" size="sm">First avatar: {status}</ZText>
    </ZStack>
  );
}

```

### Case: group

#### React
```tsx
import { ZAvatar, ZAvatarGroup, ZBadge, ZStack } from '@zelviora/react';

const team = ['Anna Lee', 'Mark Tran', 'Chloe Martin', 'David Park', 'Hannah Brooks'];

export function AvatarGroup() {
  return (
    <ZStack orientation="horizontal" alignItems="center" gap="lg" wrap>
      <ZAvatarGroup max={3} label="Project team">
        {team.map((name) => (
          <ZAvatar key={name} name={name} tone="auto" />
        ))}
      </ZAvatarGroup>
      <ZBadge mode="overlay" dot tone="success" label="Online">
        <ZAvatar name="Anna Lee" size="lg" />
      </ZBadge>
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZAvatar, ZStack } from '@zelviora/react';

const sizes = ['xs', 'sm', 'md', 'lg', 'xl'] as const;
const tones = ['neutral', 'primary', 'success', 'warning', 'destructive', 'info'] as const;
const people = ['Chloe Martin', 'David Park', 'Hannah Brooks'];

export function AvatarVariants() {
  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" alignItems="center" gap="sm">
        {sizes.map((size) => (
          <ZAvatar key={size} size={size} name={`Size ${size.toUpperCase()}`} />
        ))}
      </ZStack>
      <ZStack orientation="horizontal" alignItems="center" gap="sm">
        <ZAvatar shape="circle" name="Circle Shape" tone="primary" />
        <ZAvatar shape="square" name="Square Shape" tone="primary" />
      </ZStack>
      <ZStack orientation="horizontal" alignItems="center" gap="sm" wrap>
        {tones.map((tone) => (
          <ZAvatar key={tone} tone={tone} name={`${tone} tone`} />
        ))}
      </ZStack>
      <ZStack orientation="horizontal" alignItems="center" gap="sm">
        {people.map((name) => (
          <ZAvatar key={name} tone="auto" name={name} />
        ))}
      </ZStack>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZBackTop, ZLink, ZStack, ZText } from '@zelviora/react';

export function BackTopBasic() {
  return (
    <div className="demo-fixed-frame">
      <div id="back-top-basic-react" className="demo-scroll-frame">
        <ZStack gap="md" className="demo-long">
          <ZLink href="#back-top-basic-react">First link</ZLink>
          <ZText>Scroll this area down.</ZText>
        </ZStack>
      </div>
      <ZBackTop target="#back-top-basic-react" visibilityHeight={120}></ZBackTop>
    </div>
  );
}

```

### Case: custom

#### React
```tsx
import { ZBackTop, ZButton, ZIcon, ZStack, ZText } from '@zelviora/react';

export function BackTopCustom() {
  return (
    <div className="demo-fixed-frame">
      <div id="back-top-custom-react" className="demo-scroll-frame">
        <ZStack gap="md" className="demo-long">
          <ZButton id="back-top-custom-start-react" variant="link">Start of the list</ZButton>
          <ZText>Scroll this area down.</ZText>
        </ZStack>
      </div>
      <ZBackTop target="#back-top-custom-react" visibilityHeight={120} label="Back to the start of the list" initialFocus="#back-top-custom-start-react"><ZIcon slot="icon" name="vertical_align_top" /></ZBackTop>
    </div>
  );
}

```


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

#### React
```tsx
import { ZBadge } from '@zelviora/react';

export function BadgeBasic() {
  return <ZBadge>New</ZBadge>;
}

```

### Case: overlay

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZButton, ZStack } from '@zelviora/react';

export function BadgeOverlay() {
  const [count, setCount] = useState(5);
  return (
    <ZStack orientation="horizontal" alignItems="center" gap="lg" wrap>
      <ZBadge mode="overlay" variant="solid" tone="destructive" count={count} max={99} label="{count} unread notifications">
        <ZButton variant="outline" tone="neutral" onClick={() => setCount((c) => c + 50)}>
          Notifications
        </ZButton>
      </ZBadge>
      <ZBadge mode="overlay" variant="solid" tone="primary" dot label="New activity">
        <ZButton variant="outline" tone="neutral">Activity</ZButton>
      </ZBadge>
    </ZStack>
  );
}

```

### Case: tones

#### React
```tsx
import { ZBadge, ZStack } from '@zelviora/react';

const tones = ['neutral', 'primary', 'success', 'warning', 'destructive', 'info'] as const;
const variants = ['soft', 'solid', 'outline'] as const;

export function BadgeTones() {
  return (
    <ZStack gap="md">
      {variants.map((variant) => (
        <ZStack key={variant} orientation="horizontal" wrap gap="sm">
          {tones.map((tone) => (
            <ZBadge key={tone} tone={tone} variant={variant}>
              {tone}
            </ZBadge>
          ))}
        </ZStack>
      ))}
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZBanner } from '@zelviora/react';

export function BannerBasic() {
  return (
    <ZBanner>Scheduled maintenance on Sunday from 1:00 to 3:00.</ZBanner>
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZBanner, ZButton, ZStack } from '@zelviora/react';

export function BannerControlled() {
  const [open, setOpen] = useState(true);
  return (
    <ZStack gap="md" alignItems="start">
      <ZBanner tone="primary" dismissible open={open} onZOpenChange={(e) => setOpen(e.detail.open)}>
        Try the new dashboard.
        <ZButton slot="actions" size="sm" variant="outline" tone="neutral">Open it</ZButton>
      </ZBanner>
      {!open && <ZButton variant="link" onClick={() => setOpen(true)}>Show the banner again</ZButton>}
    </ZStack>
  );
}

```

### Case: sticky

#### React
```tsx
import { ZBanner, ZStack, ZText } from '@zelviora/react';

export function BannerSticky() {
  return (
    <div className="demo-scroll-frame">
      <ZBanner sticky={true} tone="warning" label="Maintenance">Maintenance tonight at 22:00.</ZBanner>
      <ZStack gap="md" className="demo-long">
        <ZText>Scroll this area: the banner stays at the top.</ZText>
      </ZStack>
    </div>
  );
}

```

### Case: tones

#### React
```tsx
import { ZBanner, ZButton, ZStack } from '@zelviora/react';

export function BannerTones() {
  return (
    <ZStack gap="sm">
      <ZBanner tone="info" label="Release">Version 2.0 is out.</ZBanner>
      <ZBanner tone="success" label="Saved">All changes are saved.</ZBanner>
      <ZBanner tone="warning" label="Trial">Your trial ends in 3 days.<ZButton slot="actions" size="sm" variant="outline" tone="neutral">Upgrade</ZButton></ZBanner>
      <ZBanner tone="destructive" variant="solid" label="Outage">Payments are currently unavailable.</ZBanner>
      <ZBanner tone="neutral" variant="solid" label="Notice">Read-only mode.</ZBanner>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZBarChart } from '@zelviora/react-chart';
import { revenueData, revenueSeries } from '../data.ts';

export function BarChartBasic() {
  return (
    <ZBarChart
      heading="Quarterly Cloud Infrastructure Revenue (Million USD)"
      description="Revenue comparison between 2024 and 2025 across four fiscal quarters."
      xKey="quarter" data={revenueData} series={revenueSeries}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/react';
import { ZBarChart } from '@zelviora/react-chart';
import { revenueData, revenueSeries } from '../data.ts';

export function BarChartControlled() {
  const [hidden, setHidden] = useState<string[]>([]);
  const [selected, setSelected] = useState<string>('Click any chart element to inspect');

  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <ZButton
          size="sm"
          variant="outline"
          onClick={() => setHidden([])}
        >
          Show All Series
        </ZButton>
        <ZBadge tone="primary" variant="soft">
          {selected}
        </ZBadge>
        <ZText variant="muted" size="sm">
          Hidden: {hidden.length ? hidden.join(', ') : 'none'}
        </ZText>
      </ZStack>
      <ZBarChart
        heading="Quarterly Cloud Infrastructure Revenue (Million USD) (Interactive)"
        description="Revenue comparison between 2024 and 2025 across four fiscal quarters."
        xKey="quarter" data={revenueData} series={revenueSeries}
        selectable
        hiddenSeries={hidden}
        onZSeriesToggle={(e) => setHidden(e.detail.hiddenSeries)}
        onZPointSelect={(e) =>
          setSelected(`Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`)
        }
      />
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZBarChart } from '@zelviora/react-chart';
import { revenueData, revenueSeries } from '../data.ts';

export function BarChartCustomization() {
  return (
    <ZBarChart
      className="demo-chart-brand"
      description="Revenue comparison between 2024 and 2025 across four fiscal quarters."
      valueFormat={{ maximumFractionDigits: 1 }}
      xKey="quarter" data={revenueData} series={revenueSeries} dataZoom borderRadius={6} renderer="canvas"
    >
      <span slot="heading">Quarterly Cloud Infrastructure Revenue (Million USD) — Custom Theme Tokens &amp; Canvas</span>
    </ZBarChart>
  );
}

```

### Case: states

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZBarChart } from '@zelviora/react-chart';
import { revenueData, revenueSeries } from '../data.ts';

export function BarChartStates() {
  return (
    <ZStack gap="lg">
      <ZBarChart
        heading="Loading State (aria-busy)"
        loading
        xKey="quarter" data={revenueData} series={revenueSeries}
      />
      <ZBarChart
        heading="Empty State"
        data={[]}
        series={revenueSeries}
      />
      <ZBarChart
        heading="Expanded Accessible Data Table"
        description="Revenue comparison between 2024 and 2025 across four fiscal quarters."
        showDataTable
        xKey="quarter" data={revenueData} series={revenueSeries}
      />
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZBarChart } from '@zelviora/react-chart';
import { revenueData, revenueSeries } from '../data.ts';

export function BarChartVariants() {
  return (
    <ZStack gap="lg">
      <ZBarChart
        heading="Horizontal Bar Layout"
        description="Horizontal bar layout with rounded corners alongside stacked vertical bars."
        xKey="quarter" data={revenueData} series={revenueSeries} orientation="horizontal" borderRadius={6}
      />
      <ZBarChart
        heading="Stacked Vertical Bars"
        description="Horizontal bar layout with rounded corners alongside stacked vertical bars."
        xKey="quarter" data={revenueData} series={revenueSeries} stacked barMaxWidth={36} borderRadius={4}
      />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZBoxplotChart } from '@zelviora/react-chart';
import { boxplotData, boxplotSeries } from '../data.ts';

export function BoxplotChartBasic() {
  return (
    <ZBoxplotChart
      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={boxplotData} series={boxplotSeries}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/react';
import { ZBoxplotChart } from '@zelviora/react-chart';
import { boxplotData, boxplotSeries } from '../data.ts';

export function BoxplotChartControlled() {
  const [hidden, setHidden] = useState<string[]>([]);
  const [selected, setSelected] = useState<string>('Click any chart element to inspect');

  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <ZButton
          size="sm"
          variant="outline"
          onClick={() => setHidden([])}
        >
          Show All Series
        </ZButton>
        <ZBadge tone="primary" variant="soft">
          {selected}
        </ZBadge>
        <ZText variant="muted" size="sm">
          Hidden: {hidden.length ? hidden.join(', ') : 'none'}
        </ZText>
      </ZStack>
      <ZBoxplotChart
        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={boxplotData} series={boxplotSeries}
        selectable
        hiddenSeries={hidden}
        onZSeriesToggle={(e) => setHidden(e.detail.hiddenSeries)}
        onZPointSelect={(e) =>
          setSelected(`Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`)
        }
      />
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZBoxplotChart } from '@zelviora/react-chart';
import { boxplotData, boxplotSeries } from '../data.ts';

export function BoxplotChartCustomization() {
  return (
    <ZBoxplotChart
      className="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={boxplotData} series={boxplotSeries}
    >
      <span slot="heading">Service Latency Quartile Distribution (ms) — Custom Theme Tokens &amp; Canvas</span>
    </ZBoxplotChart>
  );
}

```

### Case: states

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZBoxplotChart } from '@zelviora/react-chart';
import { boxplotData, boxplotSeries } from '../data.ts';

export function BoxplotChartStates() {
  return (
    <ZStack gap="lg">
      <ZBoxplotChart
        heading="Loading State (aria-busy)"
        loading
        xKey="service" minKey="min" q1Key="q1" medianKey="median" q3Key="q3" maxKey="max" data={boxplotData} series={boxplotSeries}
      />
      <ZBoxplotChart
        heading="Empty State"
        data={[]}
        series={boxplotSeries}
      />
      <ZBoxplotChart
        heading="Expanded Accessible Data Table"
        description="Five-number latency distribution across Gateway, Auth, Search, and Billing services."
        showDataTable
        xKey="service" minKey="min" q1Key="q1" medianKey="median" q3Key="q3" maxKey="max" data={boxplotData} series={boxplotSeries}
      />
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZBoxplotChart } from '@zelviora/react-chart';
import { boxplotData, boxplotSeries } from '../data.ts';

export function BoxplotChartVariants() {
  return (
    <ZStack gap="lg">
      <ZBoxplotChart
        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={boxplotData} series={boxplotSeries}
      />
      <ZBoxplotChart
        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 data={boxplotData} series={boxplotSeries}
      />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZBreadcrumb, ZBreadcrumbItem } from '@zelviora/react';

export function BreadcrumbBasic() {
  return (
    <ZBreadcrumb>
      <ZBreadcrumbItem href="#home">Home</ZBreadcrumbItem>
      <ZBreadcrumbItem href="#products">Products</ZBreadcrumbItem>
      <ZBreadcrumbItem>Jackets</ZBreadcrumbItem>
    </ZBreadcrumb>
  );
}

```

### Case: collapsed

#### React
```tsx
import { ZBreadcrumb, ZBreadcrumbItem } from '@zelviora/react';

const levels = ['Home', 'Fashion', 'Men', 'Tops', 'Jackets', 'Windbreakers', 'Autumn-winter collection 2026'];

export function BreadcrumbCollapsed() {
  return (
    <ZBreadcrumb maxItems={4}>
      {levels.map((label, i) => (
        <ZBreadcrumbItem key={label} href={`#level-${i + 1}`}>{label}</ZBreadcrumbItem>
      ))}
      <ZBreadcrumbItem>Water-resistant hooded windbreaker, moss green</ZBreadcrumbItem>
    </ZBreadcrumb>
  );
}

```

### Case: separator

#### React
```tsx
import { ZBreadcrumb, ZBreadcrumbItem, ZIcon, ZStack } from '@zelviora/react';

export function BreadcrumbSeparator() {
  return (
    <ZStack gap="md">
      <ZBreadcrumb label="Path with chevrons">
        <ZIcon slot="separator" name="chevron_right" />
        <ZBreadcrumbItem href="#home">Home</ZBreadcrumbItem>
        <ZBreadcrumbItem href="#settings">Settings</ZBreadcrumbItem>
        <ZBreadcrumbItem>Notifications</ZBreadcrumbItem>
      </ZBreadcrumb>
      <div dir="rtl" lang="ar">
        <ZBreadcrumb label="مسار التنقل">
          <ZIcon slot="separator" name="chevron_right" />
          <ZBreadcrumbItem href="#home">الرئيسية</ZBreadcrumbItem>
          <ZBreadcrumbItem href="#settings">الإعدادات</ZBreadcrumbItem>
          <ZBreadcrumbItem>الإشعارات</ZBreadcrumbItem>
        </ZBreadcrumb>
      </div>
    </ZStack>
  );
}

```

### Case: sizes

#### React
```tsx
import { ZBreadcrumb, ZBreadcrumbItem, ZStack } from '@zelviora/react';

const sizes = ['sm', 'md', 'lg'] as const;

export function BreadcrumbSizes() {
  return (
    <ZStack gap="md">
      {sizes.map((size) => (
        <ZBreadcrumb key={size} size={size} label={`Breadcrumb ${size}`}>
          <ZBreadcrumbItem href="#home">Home</ZBreadcrumbItem>
          <ZBreadcrumbItem href="#orders">Orders</ZBreadcrumbItem>
          <ZBreadcrumbItem>Order #1024</ZBreadcrumbItem>
        </ZBreadcrumb>
      ))}
    </ZStack>
  );
}

```

### Case: spa-routing

#### React
```tsx
import { useState, type MouseEvent } from 'react';
import { ZBreadcrumb, ZBreadcrumbItem } from '@zelviora/react';

// SPA routing (ADR-026, D-23): (1) one zNavigate listener on the breadcrumb routes the item links and the entries of
// the "…" menu; (2) an item can hold the app's own link (Next.js `Link`, React Router `Link`), used as-is.
export function BreadcrumbSpaRouting() {
  const [route, setRoute] = useState('#/products/shoes/running');
  const navigate = (e: CustomEvent<{ href: string }>) => {
    e.preventDefault();
    setRoute(e.detail.href); // router.push(e.detail.href)
  };
  // Stand-in for a router `<Link>`: it renders an `<a href>` and routes on click.
  const appLink = (e: MouseEvent<HTMLAnchorElement>) => {
    if (e.ctrlKey || e.metaKey || e.shiftKey || e.button !== 0) return;
    e.preventDefault();
    setRoute(e.currentTarget.getAttribute('href')!);
  };
  return (
    <div>
      <ZBreadcrumb maxItems={3} onZNavigate={navigate}>
        <ZBreadcrumbItem><a href="#/" onClick={appLink}>Home</a></ZBreadcrumbItem>
        <ZBreadcrumbItem href="#/products">Products</ZBreadcrumbItem>
        <ZBreadcrumbItem href="#/products/shoes">Shoes</ZBreadcrumbItem>
        <ZBreadcrumbItem href="#/products/shoes/running">Running</ZBreadcrumbItem>
        <ZBreadcrumbItem>Trail runner 2</ZBreadcrumbItem>
      </ZBreadcrumb>
      <p aria-live="polite">Current route: <code>{route}</code></p>
    </div>
  );
}

```


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

#### React
```tsx
import { ZAvatar, ZBubble, ZButton, ZStack } from '@zelviora/react';

export function BubbleActions() {
  return (
    <ZStack orientation="vertical" gap="md" className="demo-narrow">
      <ZBubble
        author="Assistant"
        time="02:30 PM"
        align="start"
        variant="secondary"
      >
        <ZAvatar slot="avatar" name="Assistant" size="sm" />
        Here is the command to install the package dependencies:
        <br />
        <code>pnpm add @zelviora/react @zelviora/icons</code>
        <ZStack slot="actions" orientation="horizontal" gap="xs">
          <ZButton size="sm" variant="ghost" tone="neutral">Copy</ZButton>
          <ZButton size="sm" variant="ghost" tone="neutral">Reply</ZButton>
        </ZStack>
      </ZBubble>
    </ZStack>
  );
}

```

### Case: basic

#### React
```tsx
import { ZAvatar, ZBubble, ZStack } from '@zelviora/react';

export function BubbleBasic() {
  return (
    <ZStack orientation="vertical" gap="md" className="demo-narrow">
      <ZBubble
        author="Sarah Connor"
        time="10:30 AM"
        align="start"
        variant="secondary"
      >
        <ZAvatar slot="avatar" name="Sarah Connor" size="sm" />
        Hi there! Have you reviewed the final design proposal for the messaging interface?
      </ZBubble>

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

      <ZBubble
        author="Sarah Connor"
        time="10:33 AM"
        align="start"
        variant="secondary"
      >
        <ZAvatar slot="avatar" name="Sarah Connor" size="sm" />
        Awesome. I will push the latest build to staging right away!
      </ZBubble>
    </ZStack>
  );
}

```

### Case: group

#### React
```tsx
import { ZAvatar, ZBubble, ZBubbleGroup, ZStack } from '@zelviora/react';

export function BubbleGroup() {
  return (
    <ZStack orientation="vertical" gap="lg" className="demo-narrow">
      {/* Incoming group from sender */}
      <ZStack orientation="horizontal" gap="sm">
        <ZAvatar name="Marcus Reed" size="sm" />
        <ZBubbleGroup align="start" variant="secondary" label="Messages from Marcus">
          <ZBubble author="Marcus Reed">
            Good morning team! We just released the latest component sprint.
          </ZBubble>
          <ZBubble>
            Please test the message bubble component across different viewport widths.
          </ZBubble>
          <ZBubble time="09:15 AM">
            Let me know if you run into any edge cases with reactions or long code snippets.
          </ZBubble>
        </ZBubbleGroup>
      </ZStack>

      {/* Outgoing group from user */}
      <ZBubbleGroup align="end" variant="primary" label="My outgoing messages">
        <ZBubble>
          On it right now!
        </ZBubble>
        <ZBubble time="09:16 AM" status="read">
          Tested the corner radius join in groups and it looks pixel perfect.
        </ZBubble>
      </ZBubbleGroup>
    </ZStack>
  );
}

```

### Case: interactive

#### React
```tsx
import { ZAvatar, ZBubble, ZStack } from '@zelviora/react';

export function BubbleInteractive() {
  return (
    <ZStack orientation="vertical" gap="md" className="demo-narrow">
      {/* Clickable button bubble */}
      <ZBubble
        author="System Prompt"
        align="start"
        variant="tinted"
        interactive
        onClick={() => alert('Bubble action clicked!')}
      >
        <ZAvatar slot="avatar" name="System Prompt" size="sm" />
        Click here to regenerate response with higher temperature.
      </ZBubble>

      {/* Linked bubble */}
      <ZBubble
        author="Documentation Bot"
        time="03:00 PM"
        align="start"
        variant="outline"
        href="#/components/bubble"
      >
        <ZAvatar slot="avatar" name="Doc Bot" size="sm" />
        View full Bubble documentation and design token reference.
      </ZBubble>
    </ZStack>
  );
}

```

### Case: reactions

#### React
```tsx
import { ZAvatar, ZBubble, ZBubbleReactions, ZStack } from '@zelviora/react';

export function BubbleReactions() {
  return (
    <ZStack orientation="vertical" gap="lg" className="demo-narrow">
      {/* Bottom aligned reactions on peer message */}
      <ZBubble
        author="Evelyn Carter"
        time="11:45 AM"
        align="start"
        variant="secondary"
      >
        <ZAvatar slot="avatar" name="Evelyn Carter" size="sm" />
        We just hit 10,000 active developers using the design system!
        <ZBubbleReactions slot="reactions" side="bottom" align="start">
          <button type="button">🔥 14</button>
          <button type="button">❤️ 9</button>
          <button type="button">👏 6</button>
        </ZBubbleReactions>
      </ZBubble>

      {/* Outbound message with end-aligned reactions */}
      <ZBubble
        time="11:47 AM"
        align="end"
        variant="primary"
        status="read"
      >
        Huge milestone for the entire engineering organization! Congrats everyone!
        <ZBubbleReactions slot="reactions" side="bottom" align="end">
          <button type="button">🙌 5</button>
        </ZBubbleReactions>
      </ZBubble>
    </ZStack>
  );
}

```

### Case: typing

#### React
```tsx
import { ZAvatar, ZBubble, ZStack } from '@zelviora/react';

export function BubbleTyping() {
  return (
    <ZStack orientation="vertical" gap="md" className="demo-narrow">
      <ZBubble
        author="Assistant"
        align="start"
        variant="secondary"
        loading
      >
        <ZAvatar slot="avatar" name="Assistant" size="sm" />
      </ZBubble>
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZBubble, ZStack } from '@zelviora/react';

export function BubbleVariants() {
  return (
    <ZStack orientation="vertical" gap="sm" className="demo-narrow">
      <ZBubble variant="default" author="Default variant">
        Neutral subtle border with clean elevated background.
      </ZBubble>

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

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

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

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

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

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

      <ZBubble variant="destructive" align="end" author="Destructive variant">
        Alert tone for failed actions or critical notifications.
      </ZBubble>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZButton } from '@zelviora/react';

export function ButtonDefault() {
  return <ZButton onClick={() => console.log('saved')}>Save</ZButton>;
}

```

### Case: form

#### React
```tsx
import { useState, type FormEvent } from 'react';
import { ZButton, ZField, ZInput, ZStack } from '@zelviora/react';

/** Submit, reset, a submitter with `name`/`value`, and `formNoValidate` that skips the required field. */
export function ButtonForm() {
  const [sent, setSent] = useState('');
  const submit = (e: FormEvent<HTMLFormElement>) => {
    e.preventDefault();
    const data = new FormData(e.currentTarget, (e.nativeEvent as SubmitEvent).submitter);
    setSent(JSON.stringify(Object.fromEntries(data)));
  };
  return (
    <form className="demo-narrow" onSubmit={submit} onReset={() => setSent('')}>
      <ZStack>
        <ZField label="Title" required>
          <ZInput name="title" required />
        </ZField>
        <ZStack orientation="horizontal" alignItems="center" gap="sm" wrap>
          <ZButton type="submit" name="action" value="publish">Publish</ZButton>
          <ZButton type="submit" name="action" value="draft" variant="soft" formNoValidate>
            Save draft
          </ZButton>
          <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
        </ZStack>
        <p>FormData: {sent || '(not submitted)'}</p>
      </ZStack>
    </form>
  );
}

```

### Case: icons

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZIcon, ZStack } from '@zelviora/react';

/** Icons go in the `icon-start` / `icon-end` slots; while loading, the spinner takes the place of the start icon. */
export function ButtonIcons() {
  const [loading, setLoading] = useState(false);
  return (
    <ZStack orientation="horizontal" alignItems="center" gap="md" wrap>
      <ZButton variant="outline" tone="neutral">
        <ZIcon slot="icon-start" name="close" />
        Discard
      </ZButton>
      <ZButton>
        Next step
        <ZIcon slot="icon-end" name="chevron_right" />
      </ZButton>
      <ZButton
        variant="soft"
        loading={loading}
        onClick={() => {
          setLoading(true);
          setTimeout(() => setLoading(false), 2000);
        }}
      >
        <ZIcon slot="icon-start" name="chevron_right" />
        Continue
      </ZButton>
    </ZStack>
  );
}

```

### Case: link

#### React
```tsx
import { ZButton, ZStack } from '@zelviora/react';

/** With `href` the button renders an `<a>`; `_blank` adds `rel="noopener noreferrer"`. A disabled link is not focusable. */
export function ButtonLink() {
  return (
    <ZStack orientation="horizontal" alignItems="center" gap="md" wrap>
      <ZButton href="#link">Go to this section</ZButton>
      <ZButton href="https://example.com" target="_blank" variant="outline">
        Open example.com
      </ZButton>
      <ZButton href="#link" variant="soft" disabled>
        Unavailable
      </ZButton>
    </ZStack>
  );
}

```

### Case: loading

#### React
```tsx
import { useState } from 'react';
import { ZButton } from '@zelviora/react';

/** Loading driven from outside: the click starts a 2 s task; the button keeps its size and focus meanwhile. */
export function ButtonLoading() {
  const [loading, setLoading] = useState(false);
  return (
    <ZButton
      loading={loading}
      onClick={() => {
        setLoading(true);
        setTimeout(() => setLoading(false), 2000);
      }}
    >
      Save changes
    </ZButton>
  );
}

```

### Case: sizes

#### React
```tsx
import { ZButton, ZStack } from '@zelviora/react';

/** Without `size` the button follows the nearest config-provider, then `md`; `block` takes the full width. */
export function ButtonSizes() {
  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" alignItems="center" gap="md" wrap>
        <ZButton size="sm">Small</ZButton>
        <ZButton size="md">Medium</ZButton>
        <ZButton size="lg">Large</ZButton>
      </ZStack>
      <ZButton block variant="soft">Export the quarterly revenue report by branch</ZButton>
    </ZStack>
  );
}

```

### Case: spa-routing

#### React
```tsx
import { useState } from 'react';
import { ZButton } from '@zelviora/react';

// SPA routing (ADR-026, D-23): a button with `href` emits zNavigate; the listener cancels it and calls the app router.
export function ButtonSpaRouting() {
  const [route, setRoute] = useState('#/home');
  const navigate = (e: CustomEvent<{ href: string }>) => {
    e.preventDefault();
    setRoute(e.detail.href); // router.push(e.detail.href)
  };
  return (
    <div>
      <ZButton href="#/orders/new" onZNavigate={navigate}>New order</ZButton>
      <p aria-live="polite">Current route: <code>{route}</code></p>
    </div>
  );
}

```

### Case: states

#### React
```tsx
import { ZButton, ZStack } from '@zelviora/react';

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

/** Disabled in every variant, loading, and disabled through a native `fieldset[disabled]`. */
export function ButtonStates() {
  return (
    <ZStack gap="lg">
      <ZStack orientation="horizontal" alignItems="center" gap="sm" wrap>
        {variants.map((variant) => (
          <ZButton key={variant} variant={variant} disabled>
            Disabled
          </ZButton>
        ))}
      </ZStack>
      <ZStack orientation="horizontal" alignItems="center" gap="sm" wrap>
        <ZButton loading>Saving</ZButton>
        <ZButton variant="outline" tone="neutral" loading loadingLabel="Exporting the report">
          Export
        </ZButton>
      </ZStack>
      <fieldset disabled>
        <legend>Fieldset disabled</legend>
        <ZStack orientation="horizontal" alignItems="center" gap="sm" wrap>
          <ZButton>Save</ZButton>
          <ZButton variant="outline" tone="neutral">Cancel</ZButton>
        </ZStack>
      </fieldset>
    </ZStack>
  );
}

```

### Case: tones

#### React
```tsx
import { ZButton, ZStack } from '@zelviora/react';

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. */
export function ButtonTones() {
  return (
    <ZStack gap="sm">
      {variants.map((variant) => (
        <ZStack key={variant} orientation="horizontal" alignItems="center" gap="sm" wrap>
          {tones.map((tone) => (
            <ZButton key={tone} variant={variant} tone={tone}>
              {tone[0].toUpperCase() + tone.slice(1)}
            </ZButton>
          ))}
        </ZStack>
      ))}
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZButton, ZStack } from '@zelviora/react';

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

export function ButtonVariants() {
  return (
    <ZStack orientation="horizontal" alignItems="center" gap="md" wrap>
      {variants.map((variant) => (
        <ZButton key={variant} variant={variant}>
          {variant[0].toUpperCase() + variant.slice(1)}
        </ZButton>
      ))}
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZButton, ZButtonGroup } from '@zelviora/react';

export function ButtonGroupBasic() {
  return (
    <ZButtonGroup label="Text alignment" variant="outline">
      <ZButton tone="neutral">Left</ZButton>
      <ZButton tone="neutral">Center</ZButton>
      <ZButton tone="neutral">Right</ZButton>
    </ZButtonGroup>
  );
}

```

### Case: split

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZButtonGroup, ZDropdownMenu, ZIcon, ZIconButton, ZMenuItem, ZStack } from '@zelviora/react';

export function ButtonGroupSplit() {
  const [last, setLast] = useState('');
  return (
    <ZStack orientation="horizontal" alignItems="center" gap="md" wrap>
      <ZButtonGroup label="Save options">
        <ZButton onClick={() => setLast('save')}>Save</ZButton>
        <ZDropdownMenu onZSelect={(e) => setLast(e.detail.value)}>
          <ZIconButton slot="trigger" variant="solid" tone="primary" label="More save options">
            <ZIcon name="chevron_right" />
          </ZIconButton>
          <ZMenuItem value="save-as">Save as…</ZMenuItem>
          <ZMenuItem value="save-copy">Save a copy</ZMenuItem>
        </ZDropdownMenu>
      </ZButtonGroup>
      <span>{last ? `Last action: ${last}` : 'No action yet'}</span>
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZButton, ZButtonGroup, ZStack } from '@zelviora/react';

const sizes = ['sm', 'md', 'lg'] as const;

export function ButtonGroupVariants() {
  return (
    <ZStack gap="md">
      {sizes.map((size) => (
        <ZButtonGroup key={size} label={`Pagination ${size}`} size={size} variant="outline">
          <ZButton tone="neutral">Previous</ZButton>
          <ZButton tone="neutral">1</ZButton>
          <ZButton tone="neutral">2</ZButton>
          <ZButton tone="neutral">Next</ZButton>
        </ZButtonGroup>
      ))}
      <ZButtonGroup label="Detached actions" detached variant="soft">
        <ZButton>Save</ZButton>
        <ZButton tone="neutral">Cancel</ZButton>
        <ZButton variant="ghost" tone="destructive">Delete</ZButton>
      </ZButtonGroup>
    </ZStack>
  );
}

```

### Case: vertical

#### React
```tsx
import { ZButton, ZButtonGroup } from '@zelviora/react';

export function ButtonGroupVertical() {
  return (
    <ZButtonGroup label="Zoom" orientation="vertical" variant="outline">
      <ZButton tone="neutral">Zoom in</ZButton>
      <ZButton tone="neutral" disabled>Reset</ZButton>
      <ZButton tone="neutral">Zoom out</ZButton>
    </ZButtonGroup>
  );
}

```


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

#### React
```tsx
import { ZButton, ZCalendar, ZCard } from '@zelviora/react';

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`. */
export function CalendarComposition() {
  return (
    <ZCard heading="Meetings" className="demo-narrow">
      <ZCalendar label="Meetings" today="2026-10-02" getDayDescription={(d) => (EVENTS[d] ? `${EVENTS[d]} ${EVENTS[d] === 1 ? 'meeting' : 'meetings'}` : undefined)}>
        {Object.keys(EVENTS).map((d) => <span key={d} slot={`day:${d}`} className="demo-calendar-dot"></span>)}
        <ZButton slot="footer" size="sm" variant="ghost">Today</ZButton>
      </ZCalendar>
    </ZCard>
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZCalendar, ZStack } from '@zelviora/react';

/** The app owns `value` and `month`: buttons set them from code (no event); the log lists user changes. */
export function CalendarControlled() {
  const [value, setValue] = useState<string | string[] | null>('2026-10-15');
  const [month, setMonth] = useState('2026-10');
  const [log, setLog] = useState<string[]>([]);
  const add = (line: string) => setLog((l) => [line, ...l].slice(0, 5));
  return (
    <ZStack className="demo-narrow">
      <ZCalendar
        label="Deadline"
       
        today="2026-10-02"
        value={value}
        month={month}
        onZChange={(e) => { setValue(e.detail.value); add(`zChange ${String(e.detail.value)}`); }}
        onZMonthChange={(e) => { setMonth(e.detail.month); add(`zMonthChange ${e.detail.month}`); }}
        onZViewChange={(e) => add(`zViewChange ${e.detail.view}`)}
      />
      <ZStack orientation="horizontal" gap="sm" wrap>
        <ZButton variant="outline" tone="neutral" onClick={() => { setValue('2026-12-31'); setMonth('2026-12'); }}>Set Dec 31, 2026</ZButton>
        <ZButton variant="outline" tone="neutral" onClick={() => setMonth('2027-01')}>Show Jan 2027</ZButton>
        <ZButton variant="outline" tone="neutral" onClick={() => setValue(null)}>Clear</ZButton>
      </ZStack>
      <span>Value: {String(value ?? 'null')} · month: {month}</span>
      <output>{log.join(' · ')}</output>
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZCalendar } from '@zelviora/react';

/** Calendar tokens and the day state parts (`::part(day-selected)`): see the `demo-calendar-brand` rule in README. */
export function CalendarCustomization() {
  return (
    <ZCalendar className="demo-calendar-brand" label="Appointment date" today="2026-10-02" selectionMode="range" defaultValue={['2026-10-12', '2026-10-16']} />
  );
}

```

### Case: default

#### React
```tsx
import { useState } from 'react';
import { ZCalendar, ZStack } from '@zelviora/react';

/** A standalone month grid: arrows move by day / week, PageUp/PageDown by month, Enter selects; "today" is fixed. */
export function CalendarDefault() {
  const [value, setValue] = useState<string | string[] | null>('2026-10-15');
  return (
    <ZStack className="demo-narrow">
      <ZCalendar label="Delivery date" today="2026-10-02" value={value} onZChange={(e) => setValue(e.detail.value)} />
      <span>Value: {String(value ?? 'null')}</span>
    </ZStack>
  );
}

```

### Case: i18n

#### React
```tsx
import { ZCalendar, ZGrid } from '@zelviora/react';

/** Month and weekday names and the first day of the week follow the locale: vi (Monday), en-US (Sunday), Arabic in RTL. */
export function CalendarI18n() {
  return (
    <ZGrid columns="1 md:3" gap="lg">
      <ZCalendar label="Tiếng Việt" locale="vi" today="2026-10-02" defaultValue="2026-10-15" />
      <ZCalendar label="English (US)" locale="en-US" today="2026-10-02" defaultValue="2026-10-15" />
      <div dir="rtl" lang="ar-EG">
        <ZCalendar label="العربية" locale="ar-EG" today="2026-10-02" defaultValue="2026-10-15" />
      </div>
    </ZGrid>
  );
}

```

### Case: months

#### React
```tsx
import { ZCalendar } from '@zelviora/react';

/** Three months side by side with ISO week numbers, picking a range across months. */
export function CalendarMonths() {
  return (
    <ZCalendar label="Holiday" today="2026-10-02" selectionMode="range" numberOfMonths={3} weekNumbers defaultValue={['2026-10-26', '2026-11-04']} />
  );
}

```

### Case: sizes

#### React
```tsx
import { ZCalendar, ZGrid } from '@zelviora/react';

/** Cell sizes follow the control heights: small, medium (default) and large. */
export function CalendarSizes() {
  return (
    <ZGrid columns="1 md:3" gap="lg">
      <ZCalendar label="Small" size="sm" today="2026-10-02" defaultValue="2026-10-15" />
      <ZCalendar label="Medium" size="md" today="2026-10-02" defaultValue="2026-10-15" />
      <ZCalendar label="Large" size="lg" today="2026-10-02" defaultValue="2026-10-15" />
    </ZGrid>
  );
}

```

### Case: states

#### React
```tsx
import { ZCalendar, ZGrid } from '@zelviora/react';

/** Today, selected range, outside days, unavailable days (min / max), outside days hidden, disabled and readonly. */
export function CalendarStates() {
  return (
    <ZGrid columns="1 sm:2" gap="lg">
      <ZCalendar label="Range, min 05 / max 25" today="2026-10-02" selectionMode="range" defaultValue={['2026-10-08', '2026-10-14']} min="2026-10-05" max="2026-10-25" />
      <ZCalendar label="Outside days hidden" today="2026-10-02" defaultValue="2026-10-02" hideOutsideDays />
      <ZCalendar label="Disabled" today="2026-10-02" defaultValue="2026-10-15" disabled />
      <ZCalendar label="Readonly" today="2026-10-02" defaultValue="2026-10-15" readonly />
    </ZGrid>
  );
}

```

### Case: unavailable

#### React
```tsx
import { ZCalendar } from '@zelviora/react';

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. */
export function CalendarUnavailable() {
  return (
    <ZCalendar className="demo-narrow" label="Working day" today="2026-10-02" isDateUnavailable={isClosed}>
      <span slot="footer">Closed on Saturdays, Sundays and Oct 20</span>
    </ZCalendar>
  );
}

```

### Case: variants

#### React
```tsx
import { ZCalendar, ZGrid } from '@zelviora/react';

/** Selection modes: one day, several days, a range of days, and display only (no selection). */
export function CalendarVariants() {
  return (
    <ZGrid columns="1 sm:2" gap="lg">
      <ZCalendar label="single" today="2026-10-02" defaultValue="2026-10-15" />
      <ZCalendar label="multiple" today="2026-10-02" selectionMode="multiple" defaultValue={['2026-10-06', '2026-10-08', '2026-10-20']} />
      <ZCalendar label="range" today="2026-10-02" selectionMode="range" defaultValue={['2026-10-12', '2026-10-16']} />
      <ZCalendar label="none" today="2026-10-02" selectionMode="none" />
    </ZGrid>
  );
}

```


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

#### React
```tsx
import { ZCandlestickChart } from '@zelviora/react-chart';
import { ohlcData, ohlcSeries } from '../data.ts';

export function CandlestickChartBasic() {
  return (
    <ZCandlestickChart
      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={ohlcData} series={ohlcSeries}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/react';
import { ZCandlestickChart } from '@zelviora/react-chart';
import { ohlcData, ohlcSeries } from '../data.ts';

export function CandlestickChartControlled() {
  const [hidden, setHidden] = useState<string[]>([]);
  const [selected, setSelected] = useState<string>('Click any chart element to inspect');

  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <ZButton
          size="sm"
          variant="outline"
          onClick={() => setHidden([])}
        >
          Show All Series
        </ZButton>
        <ZBadge tone="primary" variant="soft">
          {selected}
        </ZBadge>
        <ZText variant="muted" size="sm">
          Hidden: {hidden.length ? hidden.join(', ') : 'none'}
        </ZText>
      </ZStack>
      <ZCandlestickChart
        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={ohlcData} series={ohlcSeries}
        selectable
        hiddenSeries={hidden}
        onZSeriesToggle={(e) => setHidden(e.detail.hiddenSeries)}
        onZPointSelect={(e) =>
          setSelected(`Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`)
        }
      />
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZCandlestickChart } from '@zelviora/react-chart';
import { ohlcData, ohlcSeries } from '../data.ts';

export function CandlestickChartCustomization() {
  return (
    <ZCandlestickChart
      className="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 renderer="canvas" data={ohlcData} series={ohlcSeries}
    >
      <span slot="heading">Daily OHLC Price Action (USD) — Custom Theme Tokens &amp; Canvas</span>
    </ZCandlestickChart>
  );
}

```

### Case: states

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZCandlestickChart } from '@zelviora/react-chart';
import { ohlcData, ohlcSeries } from '../data.ts';

export function CandlestickChartStates() {
  return (
    <ZStack gap="lg">
      <ZCandlestickChart
        heading="Loading State (aria-busy)"
        loading
        xKey="date" openKey="open" closeKey="close" lowKey="low" highKey="high" data={ohlcData} series={ohlcSeries}
      />
      <ZCandlestickChart
        heading="Empty State"
        data={[]}
        series={ohlcSeries}
      />
      <ZCandlestickChart
        heading="Expanded Accessible Data Table"
        description="Five-day trading sessions showing open, close, intraday low, and intraday high prices."
        showDataTable
        xKey="date" openKey="open" closeKey="close" lowKey="low" highKey="high" data={ohlcData} series={ohlcSeries}
      />
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZCandlestickChart } from '@zelviora/react-chart';
import { ohlcData, ohlcSeries } from '../data.ts';

export function CandlestickChartVariants() {
  return (
    <ZStack gap="lg">
      <ZCandlestickChart
        heading="Interactive DataZoom Candlesticks"
        description="Interactive dataZoom trading view vs compact session view."
        xKey="date" openKey="open" closeKey="close" lowKey="low" highKey="high" dataZoom data={ohlcData} series={ohlcSeries}
      />
      <ZCandlestickChart
        heading="Standard Session View"
        description="Interactive dataZoom trading view vs compact session view."
        xKey="date" openKey="open" closeKey="close" lowKey="low" highKey="high" hideLegend data={ohlcData} series={ohlcSeries}
      />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZButton, ZCard } from '@zelviora/react';

export function CardBasic() {
  return (
    <ZCard heading="Revenue, September" description="Updated 2 hours ago" as="section" className="demo-narrow">
      <p>1.2 billion VND, up 12% from August.</p>
      <ZButton slot="footer" variant="outline" tone="neutral">View details</ZButton>
    </ZCard>
  );
}

```

### Case: link

#### React
```tsx
import { ZButton, ZCard } from '@zelviora/react';

export function CardLink() {
  return (
    <ZCard heading="Quarterly report" description="Q3 2026" href="#report-q3" as="article" className="demo-narrow">
      <p>Click anywhere on the card to open the report.</p>
      <ZButton slot="footer" variant="ghost" tone="neutral" onClick={() => console.log('shared')}>
        Share
      </ZButton>
    </ZCard>
  );
}

```

### Case: loading

#### React
```tsx
import { useEffect, useState } from 'react';
import { ZCard } from '@zelviora/react';

export function CardLoading() {
  const [loading, setLoading] = useState(true);
  useEffect(() => {
    const id = setTimeout(() => setLoading(false), 2000);
    return () => clearTimeout(id);
  }, []);
  return (
    <ZCard heading="Active users" loading={loading} className="demo-narrow">
      <p>4,210 users in the last 30 days.</p>
    </ZCard>
  );
}

```

### Case: variants

#### React
```tsx
import { ZCard, ZGrid } from '@zelviora/react';

export function CardVariants() {
  return (
    <ZGrid minColumnWidth="12rem">
      <ZCard heading="Outline">Border and card background.</ZCard>
      <ZCard heading="Soft" variant="soft">Muted background, no border.</ZCard>
      <ZCard heading="Ghost" variant="ghost">No background or border.</ZCard>
      <ZCard heading="Elevated" elevated>Raised shadow.</ZCard>
    </ZGrid>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZCarousel, ZCarouselItem, ZStack } from '@zelviora/react';

const SLIDES = ['20% off in October', 'Free shipping', 'Member gifts'];

/**
 * 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.
 */
export function CarouselAutoplay() {
  const [playing, setPlaying] = useState(true);
  return (
    <ZStack>
      <ZCarousel label="Banner" autoplay autoplayInterval={4000} onZAutoplayChange={(e) => setPlaying(e.detail.playing)}>
        {SLIDES.map((s) => <ZCarouselItem key={s} label={s}><div className="demo-carousel-slide">{s}</div></ZCarouselItem>)}
      </ZCarousel>
      <span>Autoplay: {playing ? 'on' : 'stopped'}</span>
    </ZStack>
  );
}

```

### Case: composition

#### React
```tsx
import { ZButton, ZCard, ZCarousel, ZCarouselItem } from '@zelviora/react';

const 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' },
];

/** Slides are cards with actions, two per page; only the cards of the current page are reachable with Tab. */
export function CarouselComposition() {
  return (
    <ZCarousel label="Pricing" slidesPerPage={2}>
      {PLANS.map((p) => (
        <ZCarouselItem key={p.name} label={p.name}>
          <ZCard heading={p.name} description={p.price}>
            <p>{p.text}</p>
            <ZButton size="sm">Choose plan</ZButton>
          </ZCard>
        </ZCarouselItem>
      ))}
    </ZCarousel>
  );
}

```

### Case: controlled

#### React
```tsx
import { useRef, useState } from 'react';
import { ZButton, ZCarousel, ZCarouselItem, ZStack } from '@zelviora/react';

const SLIDES = ['One', 'Two', 'Three', 'Four', 'Five'];

/** The app owns `index`: setting it emits nothing; `goTo()` emits `reason: programmatic`; the log lists every change. */
export function CarouselControlled() {
  const [index, setIndex] = useState(1);
  const [log, setLog] = useState<string[]>([]);
  const ref = useRef<HTMLZCarouselElement>(null);
  return (
    <ZStack>
      <ZCarousel
        ref={ref}
        label="Controlled"
        index={index}
        onZChange={(e) => { setIndex(e.detail.index); setLog((l) => [`${e.detail.index} (${e.detail.reason})`, ...l].slice(0, 5)); }}
      >
        {SLIDES.map((s) => <ZCarouselItem key={s}><div className="demo-carousel-slide">{s}</div></ZCarouselItem>)}
      </ZCarousel>
      <ZStack orientation="horizontal" gap="sm" wrap>
        <ZButton variant="outline" tone="neutral" onClick={() => setIndex(0)}>index = 0</ZButton>
        <ZButton variant="outline" tone="neutral" onClick={() => setIndex(4)}>index = 4</ZButton>
        <ZButton variant="outline" tone="neutral" onClick={() => void ref.current?.goTo(2)}>goTo(2)</ZButton>
      </ZStack>
      <span>Index: {index}</span>
      <output>{log.join(' · ')}</output>
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZCarousel, ZCarouselItem } from '@zelviora/react';

const SLIDES = ['One', 'Two', 'Three'];

/** Component tokens and parts (`::part(picker-item-active)`): see the `demo-carousel-brand` rule in README. */
export function CarouselCustomization() {
  return (
    <ZCarousel className="demo-carousel-brand" label="Customization" loop>
      {SLIDES.map((s) => <ZCarouselItem key={s}><div className="demo-carousel-slide">{s}</div></ZCarouselItem>)}
    </ZCarousel>
  );
}

```

### Case: default

#### React
```tsx
import { ZCarousel, ZCarouselItem } from '@zelviora/react';

const SLIDES = ['20% off in October', 'Free shipping', 'Member gifts', '0% installments', '30-day returns'];

/** Five slides with previous / next buttons and a picker; swipe, scroll or drag the track; Tab reaches the buttons. */
export function CarouselDefault() {
  return (
    <ZCarousel label="Featured offers">
      {SLIDES.map((s) => (
        <ZCarouselItem key={s} label={s}><div className="demo-carousel-slide">{s}</div></ZCarouselItem>
      ))}
    </ZCarousel>
  );
}

```

### Case: i18n

#### React
```tsx
import { ZCarousel, ZCarouselItem, ZStack } from '@zelviora/react';

const SLIDES = ['1', '2', '3'];

/** Button and slide names follow the locale (vi); in RTL the next button scrolls toward the left. */
export function CarouselI18n() {
  return (
    <ZStack gap="lg">
      <div lang="vi">
        <ZCarousel label="Tiếng Việt">
          {SLIDES.map((s) => <ZCarouselItem key={s}><div className="demo-carousel-slide">{`Slide ${s}`}</div></ZCarouselItem>)}
        </ZCarousel>
      </div>
      <div dir="rtl" lang="ar">
        <ZCarousel label="RTL" picker="tabs">
          {SLIDES.map((s) => <ZCarouselItem key={s}><div className="demo-carousel-slide">{`RTL ${s}`}</div></ZCarouselItem>)}
        </ZCarousel>
      </div>
    </ZStack>
  );
}

```

### Case: per-page

#### React
```tsx
import { ZCarousel, ZCarouselItem, ZContainer, ZStack } from '@zelviora/react';

const MANY = Array.from({ length: 30 }, (_, i) => `Product ${i + 1}`);

/**
 * Two and three slides per page (30 slides), and `slides-per-page="auto"` read from a container query
 * (`demo-carousel-auto` rule in README).
 */
export function CarouselPerPage() {
  return (
    <ZStack gap="lg">
      <ZCarousel label="2 per page" slidesPerPage={2}>
        {MANY.slice(0, 6).map((s) => <ZCarouselItem key={s}><div className="demo-carousel-slide">{s}</div></ZCarouselItem>)}
      </ZCarousel>
      <ZCarousel label="3 per page, 30 slides" slidesPerPage={3} gap="sm">
        {MANY.map((s) => <ZCarouselItem key={s}><div className="demo-carousel-slide">{s}</div></ZCarouselItem>)}
      </ZCarousel>
      <ZContainer padding="none">
        <ZCarousel className="demo-carousel-auto" label="auto" slidesPerPage="auto">
          {MANY.slice(0, 8).map((s) => <ZCarouselItem key={s}><div className="demo-carousel-slide">{s}</div></ZCarouselItem>)}
        </ZCarousel>
      </ZContainer>
    </ZStack>
  );
}

```

### Case: states

#### React
```tsx
import { ZCarousel, ZCarouselItem, ZStack } from '@zelviora/react';

const SLIDES = ['One', 'Two', 'Three'];

/** First page (previous is aria-disabled, still focusable), last page, loop (no edge), and no slide (nothing shown). */
export function CarouselStates() {
  return (
    <ZStack gap="lg">
      <ZCarousel label="First page">
        {SLIDES.map((s) => <ZCarouselItem key={s}><div className="demo-carousel-slide">{s}</div></ZCarouselItem>)}
      </ZCarousel>
      <ZCarousel label="Last page" defaultIndex={2}>
        {SLIDES.map((s) => <ZCarouselItem key={s}><div className="demo-carousel-slide">{s}</div></ZCarouselItem>)}
      </ZCarousel>
      <ZCarousel label="Loop" loop>
        {SLIDES.map((s) => <ZCarouselItem key={s}><div className="demo-carousel-slide">{`loop: ${s}`}</div></ZCarouselItem>)}
      </ZCarousel>
      <ZCarousel label="Empty"></ZCarousel>
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZCarousel, ZCarouselItem, ZStack } from '@zelviora/react';

const SLIDES = ['One', 'Two', 'Three', 'Four'];

/** Picker as buttons with aria-current (default), as an APG tab list (arrow keys), or none. */
export function CarouselVariants() {
  return (
    <ZStack gap="lg">
      {(['buttons', 'tabs', 'none'] as const).map((picker) => (
        <ZCarousel key={picker} label={`picker ${picker}`} picker={picker}>
          {SLIDES.map((s) => <ZCarouselItem key={s}><div className="demo-carousel-slide">{`${picker}: ${s}`}</div></ZCarouselItem>)}
        </ZCarousel>
      ))}
    </ZStack>
  );
}

```

### Case: vertical

#### React
```tsx
import { ZCarousel, ZCarouselItem } from '@zelviora/react';

const NEWS = ['Version 2.0 released', 'System maintenance on Oct 20', 'We are hiring engineers', 'User conference'];

/** Vertical track (orientation vertical): buttons and picker move up and down. */
export function CarouselVertical() {
  return (
    <ZCarousel label="News" orientation="vertical">
      {NEWS.map((s) => <ZCarouselItem key={s} label={s}><div className="demo-carousel-slide">{s}</div></ZCarouselItem>)}
    </ZCarousel>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZCascader, ZStack } from '@zelviora/react';
import { places } from '../data.ts';

/** changeOnSelect: any level can be chosen; expandTrigger="hover" opens columns on mouse hover. */
export function CascaderChangeOnSelect() {
  const [value, setValue] = useState<string[] | null>(null);
  return (
    <ZStack className="demo-narrow">
      <ZCascader label="Region (any level)" changeOnSelect options={places} onZChange={(e) => setValue(e.detail.value)} />
      <span>Value: {value ? value.join(' → ') : 'null'}</span>
      <ZCascader label="Open on hover" expandTrigger="hover" options={places} />
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { useState } from 'react';
import { ZCascader, ZStack } from '@zelviora/react';
import { places } from '../data.ts';

/** Province → district → ward; a disabled province, clear button; filled variant, disabled and readonly. */
export function CascaderDefault() {
  const [value, setValue] = useState<string[] | null>(['hn', 'ba-dinh', 'phuc-xa']);
  return (
    <ZStack className="demo-narrow">
      <ZCascader label="Address" options={places} value={value} clearable onZChange={(e) => setValue(e.detail.value)} />
      <span>Value: {value ? value.join(' → ') : 'null'}</span>
      <ZCascader label="Filled" variant="filled" options={places} displaySeparator=" › " />
      <ZCascader label="Disabled" options={places} defaultValue={['dn', 'hai-chau', 'thach-thang']} disabled />
      <ZCascader label="Readonly" options={places} defaultValue={['dn', 'hai-chau', 'thach-thang']} readonly />
    </ZStack>
  );
}

```

### Case: form

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZCascader, ZStack } from '@zelviora/react';
import { places } from '../data.ts';

/** Required in a native form: the leaf value (default) or every level (formValue="path"). */
export function CascaderForm() {
  const [sent, setSent] = useState('');
  return (
    <form
      className="demo-narrow"
      onSubmit={(e) => {
        e.preventDefault();
        const data = new FormData(e.currentTarget);
        setSent(JSON.stringify({ ward: data.get('ward'), path: data.getAll('path') }));
      }}
    >
      <ZStack>
        <ZCascader name="ward" label="Ward / commune" hint="Required; submits the ward" required options={places} />
        <ZCascader name="path" label="Path" hint='formValue="path": one entry per level' formValue="path" options={places} />
        <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
          <ZButton type="submit">Submit</ZButton>
          <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
        </ZStack>
        {sent && <output>{sent}</output>}
      </ZStack>
    </form>
  );
}

```

### Case: i18n

#### React
```tsx
import { ZCascader, ZConfigProvider } from '@zelviora/react';
import { places } from '../data-i18n.ts';

/** With locale `vi` the search ignores accents ("phuc xa" finds "Phúc Xá") and the built-in texts are Vietnamese. */
export function CascaderI18n() {
  return (
    <ZConfigProvider locale="vi">
      <div className="demo-narrow">
        <ZCascader label="Tìm địa chỉ" searchable options={places} />
      </div>
    </ZConfigProvider>
  );
}

```

### Case: lazy

#### React
```tsx
import { ZCascader, ZStack } from '@zelviora/react';
import { loadRegion, regions } from '../data.ts';

/** loadChildren: columns load on demand (fixed delay); the option shows a busy indicator meanwhile. */
export function CascaderLazy() {
  return (
    <ZStack className="demo-narrow">
      <ZCascader label="Branch" options={regions} loadChildren={loadRegion} />
    </ZStack>
  );
}

```

### Case: search

#### React
```tsx
import { useState } from 'react';
import { ZCascader, ZStack } from '@zelviora/react';
import { manyOptions, places } from '../data.ts';

/** Search on any level (e.g. "phuc"); 1,000 options in a column scroll virtually, zLoadMore at the end. */
export function CascaderSearch() {
  const [log, setLog] = useState('');
  return (
    <ZStack className="demo-narrow">
      <ZCascader label="Find address" searchable options={places} onZSearch={(e) => setLog(`zSearch "${e.detail.query}"`)} />
      <ZCascader label="Units (1,000 items)" searchable options={manyOptions} onZLoadMore={() => setLog('zLoadMore')} />
      <output>{log}</output>
    </ZStack>
  );
}

```


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

#### React
```tsx
import '@zelviora/third-party/chart';
import { ZChart } from '@zelviora/react/third-party';
import { revenue, revenueSeries } from '../data.ts';

/** Importing `@zelviora/third-party/chart` once registers the drawing library (optional peer `d3-shape`). */
export function ChartBasic() {
  return (
    <ZChart
      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={revenue}
      series={revenueSeries}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import '@zelviora/third-party/chart';
import { ZButton, ZStack } from '@zelviora/react';
import { ZChart } from '@zelviora/react/third-party';
import { revenue, revenueSeries } from '../data.ts';

/** The app owns `hiddenSeries`: the buttons and the legend change the same state (zSeriesToggle). */
export function ChartControlled() {
  const [hidden, setHidden] = useState<string[]>(['y2024']);
  const toggle = (key: string) => setHidden((h) => (h.includes(key) ? h.filter((k) => k !== key) : [...h, key]));
  return (
    <ZStack>
      <ZStack orientation="horizontal" gap="sm">
        {revenueSeries.map((s) => (
          <ZButton key={s.key} variant="outline" tone="neutral" onClick={() => toggle(s.key)}>
            {hidden.includes(s.key) ? `Show ${s.label}` : `Hide ${s.label}`}
          </ZButton>
        ))}
      </ZStack>
      <ZChart
        type="line"
        heading="Revenue per quarter"
        xKey="quarter"
        data={revenue}
        series={revenueSeries}
        hiddenSeries={hidden}
        onZSeriesToggle={(e) => setHidden(e.detail.hiddenSeries)}
      />
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import '@zelviora/third-party/chart';
import { ZChart } from '@zelviora/react/third-party';
import { revenue, revenueSeries } from '../data.ts';

/** Component tokens (series colors, height) and parts (heading, legend item) through the demo-chart-brand class. */
export function ChartCustomization() {
  return (
    <ZChart className="demo-chart-brand" type="bar" xKey="quarter" data={revenue} series={revenueSeries}>
      <span slot="heading">Revenue per quarter, brand colors</span>
    </ZChart>
  );
}

```

### Case: dashboard

#### React
```tsx
import '@zelviora/third-party/chart';
import { ZButton, ZCard, ZGrid, ZGridItem } from '@zelviora/react';
import { ZChart } from '@zelviora/react/third-party';
import { revenue, revenueSeries, traffic, visitsSeries } from '../data.ts';

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

```

### Case: i18n

#### React
```tsx
import '@zelviora/third-party/chart';
import { ZConfigProvider, ZGrid, ZGridItem } from '@zelviora/react';
import { ZChart } from '@zelviora/react/third-party';
import { revenueSeries, revenueVnd } from '../data.ts';

const money: Intl.NumberFormatOptions = { style: 'currency', currency: 'VND', notation: 'compact' };

/** Numbers and texts follow the locale of the nearest `lang` (config provider): `vi` and `en-US`. */
export function ChartI18n() {
  return (
    <ZGrid columns="1 md:2" gap="lg">
      <ZGridItem>
        <ZConfigProvider locale="vi">
          <ZChart heading="Doanh thu theo quý" showDataTable valueFormat={money} xKey="quarter" data={revenueVnd} series={revenueSeries} />
        </ZConfigProvider>
      </ZGridItem>
      <ZGridItem>
        <ZConfigProvider locale="en-US">
          <ZChart heading="Revenue per quarter" showDataTable valueFormat={money} xKey="quarter" data={revenueVnd} series={revenueSeries} />
        </ZConfigProvider>
      </ZGridItem>
    </ZGrid>
  );
}

```

### Case: keyboard

#### React
```tsx
import { useState } from 'react';
import '@zelviora/third-party/chart';
import { ZStack } from '@zelviora/react';
import { ZChart } from '@zelviora/react/third-party';
import { revenue, revenueSeries } from '../data.ts';

/** Tab to the plot, move with the arrow keys (the value is announced), Enter selects, Escape hides the tooltip. */
export function ChartKeyboard() {
  const [picked, setPicked] = useState('Nothing selected');
  return (
    <ZStack>
      <ZChart
        type="bar"
        heading="Revenue per quarter"
        selectable
        xKey="quarter"
        data={revenue}
        series={revenueSeries}
        onZPointSelect={(e) => setPicked(`${e.detail.seriesKey} · ${String(e.detail.datum.quarter)}`)}
      />
      <output>{picked}</output>
    </ZStack>
  );
}

```

### Case: long

#### React
```tsx
import '@zelviora/third-party/chart';
import { ZStack } from '@zelviora/react';
import { ZChart } from '@zelviora/react/third-party';
import { regions, salesSeries, signups, signupsSeries } from '../data.ts';

const vnd: Intl.NumberFormatOptions = { style: 'currency', currency: 'VND', notation: 'compact' };

/** 200 points with a long series label, then long category names with large numbers (compact currency). */
export function ChartLong() {
  return (
    <ZStack gap="lg">
      <ZChart type="line" heading="Sign-ups over 200 days" xKey="day" data={signups} series={signupsSeries} />
      <ZChart type="bar" orientation="horizontal" heading="Sales by region" valueFormat={vnd} xKey="region" data={regions} series={salesSeries} showDataTable />
    </ZStack>
  );
}

```

### Case: rtl

#### React
```tsx
import '@zelviora/third-party/chart';
import { ZGrid, ZGridItem } from '@zelviora/react';
import { ZChart } from '@zelviora/react/third-party';
import { revenueAr, revenueSeriesAr } from '../data.ts';

/** RTL: the category axis runs from the right, value ticks sit on the right and the arrow keys follow the reading order. */
export function ChartRtl() {
  return (
    <div dir="rtl" lang="ar">
      <ZGrid columns="1 md:2" gap="lg">
        <ZGridItem><ZChart type="bar" heading="الإيرادات حسب الربع" xKey="quarter" data={revenueAr} series={revenueSeriesAr} keyboardNavigation /></ZGridItem>
        <ZGridItem><ZChart type="line" heading="الإيرادات حسب الربع (خط)" xKey="quarter" data={revenueAr} series={revenueSeriesAr} /></ZGridItem>
      </ZGrid>
    </div>
  );
}

```

### Case: states

#### React
```tsx
import '@zelviora/third-party/chart';
import { ZGrid, ZGridItem } from '@zelviora/react';
import { ZChart } from '@zelviora/react/third-party';
import { revenue, revenueSeries } from '../data.ts';

/** Loading (skeleton, aria-busy), empty data (default empty state) and the data table shown visually. */
export function ChartStates() {
  return (
    <ZGrid columns="1 md:2" gap="lg">
      <ZGridItem><ZChart heading="Loading" loading xKey="quarter" data={revenue} series={revenueSeries} /></ZGridItem>
      <ZGridItem><ZChart heading="No data yet" xKey="quarter" data={[]} series={revenueSeries} /></ZGridItem>
      <ZGridItem><ZChart type="line" heading="With the data table" showDataTable xKey="quarter" data={revenue} series={revenueSeries} /></ZGridItem>
    </ZGrid>
  );
}

```

### Case: theme

#### React
```tsx
import '@zelviora/third-party/chart';
import { ZCard, ZConfigProvider, ZGrid, ZGridItem } from '@zelviora/react';
import { ZChart } from '@zelviora/react/third-party';
import { revenue, revenueSeries } from '../data.ts';

/** Light and dark side by side: series, grid and axis colors come from tokens, so a theme change restyles the chart. */
export function ChartTheme() {
  return (
    <ZGrid columns="1 md:2" gap="lg">
      <ZGridItem>
        <ZConfigProvider theme="light">
          <ZCard>
            <ZChart type="area" heading="Revenue (light)" xKey="quarter" data={revenue} series={revenueSeries} />
          </ZCard>
        </ZConfigProvider>
      </ZGridItem>
      <ZGridItem>
        <ZConfigProvider theme="dark">
          <ZCard>
            <ZChart type="area" heading="Revenue (dark)" xKey="quarter" data={revenue} series={revenueSeries} />
          </ZCard>
        </ZConfigProvider>
      </ZGridItem>
    </ZGrid>
  );
}

```

### Case: types

#### React
```tsx
import '@zelviora/third-party/chart';
import { ZGrid, ZGridItem } from '@zelviora/react';
import { ZChart } from '@zelviora/react/third-party';
import { latency, latencySeries, revenue, revenueSeries, traffic, visitsSeries } from '../data.ts';

/** Six types; series also differ by marker shape and line dash, not only by color. */
export function ChartTypes() {
  return (
    <ZGrid columns="1 md:2" gap="lg">
      <ZGridItem><ZChart type="bar" heading="Bar, stacked" stacked xKey="quarter" data={revenue} series={revenueSeries} /></ZGridItem>
      <ZGridItem><ZChart type="bar" orientation="horizontal" heading="Bar, horizontal" xKey="quarter" data={revenue} series={revenueSeries} /></ZGridItem>
      <ZGridItem><ZChart type="line" heading="Line" xKey="quarter" data={revenue} series={revenueSeries} /></ZGridItem>
      <ZGridItem><ZChart type="area" heading="Area, stacked" stacked xKey="quarter" data={revenue} series={revenueSeries} /></ZGridItem>
      <ZGridItem><ZChart type="pie" heading="Pie" xKey="source" data={traffic} series={visitsSeries} /></ZGridItem>
      <ZGridItem><ZChart type="donut" heading="Donut" xKey="source" data={traffic} series={visitsSeries} /></ZGridItem>
      <ZGridItem><ZChart type="scatter" heading="Scatter: latency (ms) by payload (kB)" xKey="size" data={latency} series={latencySeries} /></ZGridItem>
    </ZGrid>
  );
}

```


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

#### React
```tsx
import { ZCheckbox } from '@zelviora/react';

export function CheckboxDefault() {
  return <ZCheckbox name="remember">Remember me</ZCheckbox>;
}

```

### Case: group

#### React
```tsx
import { useState } from 'react';
import { ZCheckbox, ZCheckboxGroup, ZStack } from '@zelviora/react';

export function CheckboxGroup() {
  const [value, setValue] = useState<string[]>(['cheese']);
  return (
    <ZStack>
      <ZCheckboxGroup name="toppings" label="Toppings" hint="Pick at least one." required value={value} onZChange={(e) => setValue(e.detail.value)}>
        <ZCheckbox value="cheese">Cheese</ZCheckbox>
        <ZCheckbox value="mushroom">Mushroom</ZCheckbox>
        <ZCheckbox value="olive">Olive</ZCheckbox>
      </ZCheckboxGroup>
      <p>Selected: {value.join(', ') || 'none'}</p>
    </ZStack>
  );
}

```

### Case: select-all

#### React
```tsx
import { useState } from 'react';
import { ZCheckbox, ZStack } from '@zelviora/react';

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

export function CheckboxSelectAll() {
  const [selected, setSelected] = useState<string[]>(['report.pdf']);
  const all = selected.length === FILES.length;
  const some = selected.length > 0 && !all;
  return (
    <ZStack gap="sm">
      <ZCheckbox checked={all} indeterminate={some} onZChange={(e) => setSelected(e.detail.checked ? FILES : [])}>
        Select all files
      </ZCheckbox>
      {FILES.map((f) => (
        <ZCheckbox
          key={f}
          checked={selected.includes(f)}
          onZChange={(e) => setSelected((s) => (e.detail.checked ? [...s, f] : s.filter((x) => x !== f)))}
        >
          {f}
        </ZCheckbox>
      ))}
    </ZStack>
  );
}

```

### Case: states

#### React
```tsx
import { ZCheckbox, ZStack } from '@zelviora/react';

export function CheckboxStates() {
  return (
    <ZStack gap="sm">
      <ZCheckbox>Unchecked</ZCheckbox>
      <ZCheckbox defaultChecked>Checked</ZCheckbox>
      <ZCheckbox indeterminate>Indeterminate</ZCheckbox>
      <ZCheckbox disabled defaultChecked>Disabled</ZCheckbox>
      <ZCheckbox readonly defaultChecked>Read-only</ZCheckbox>
      <ZCheckbox invalid hint="You must accept the terms to continue.">I accept the terms</ZCheckbox>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZCodeBlock } from '@zelviora/react';

const code = `import { ZButton } from '@zelviora/react';

export const Save = () => <ZButton>Save</ZButton>;`;

export function CodeBlockBasic() {
  return <ZCodeBlock language="tsx" code={code} />;
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZCodeBlock, ZStack } from '@zelviora/react';

export function CodeBlockControlled() {
  const [message, setMessage] = useState('');
  return (
    <ZStack gap="sm">
      <ZCodeBlock
        language="bash"
        code="export API_KEY=sk_live_1234"
        onZCopy={(e) => {
          // Cancel the default copy and copy a masked value instead.
          e.preventDefault();
          void navigator.clipboard?.writeText('export API_KEY=<your key>');
          setMessage(`Copied a masked version of: ${e.detail.text.length} characters`);
        }}
      />
      <span>{message || 'Press the copy button.'}</span>
    </ZStack>
  );
}

```

### Case: highlighter

#### React
```tsx
import { ZCodeBlock } from '@zelviora/react';

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 = (code: string) =>
  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 };
    }),
  );

const code = `import { total } from './cart';

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

export function CodeBlockHighlighter() {
  return <ZCodeBlock filename="shipping.js" language="js" highlight={highlight} code={code} />;
}

```

### Case: line-numbers

#### React
```tsx
import { ZCodeBlock } from '@zelviora/react';

const code = `{
  "name": "shop",
  "private": true,
  "dependencies": {
    "@zelviora/core": "^1.0.0"
  }
}`;

export function CodeBlockLineNumbers() {
  return <ZCodeBlock filename="package.json" language="json" lineNumbers highlightLines="4-6" code={code} />;
}

```

### Case: long

#### React
```tsx
import { ZCodeBlock, ZStack } from '@zelviora/react';

const longLine = `curl -X POST https://api.example.com/v1/orders -H "Authorization: Bearer ${'x'.repeat(120)}" -d '{"items":[{"sku":"A-1","qty":2}]}'`;
const 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');

export function CodeBlockLong() {
  return (
    <ZStack gap="md">
      <ZCodeBlock language="bash" code={longLine} />
      <ZCodeBlock language="bash" wrap code={longLine} />
      <ZCodeBlock filename="worker.log" lineNumbers code={log} />
    </ZStack>
  );
}

```

### Case: tabs

#### React
```tsx
import { ZCodeBlock, ZTabs, ZTabsList, ZTabsPanel, ZTabsTrigger } from '@zelviora/react';

const html = '<z-button>Save</z-button>';
const jsx = '<ZButton>Save</ZButton>';

export function CodeBlockTabs() {
  return (
    <ZTabs defaultValue="react">
      <ZTabsList label="Framework">
        <ZTabsTrigger value="html">HTML</ZTabsTrigger>
        <ZTabsTrigger value="react">React</ZTabsTrigger>
        <ZTabsTrigger value="vue">Vue</ZTabsTrigger>
        <ZTabsTrigger value="angular">Angular</ZTabsTrigger>
      </ZTabsList>
      <ZTabsPanel value="html"><ZCodeBlock language="html" code={html} /></ZTabsPanel>
      <ZTabsPanel value="react"><ZCodeBlock language="tsx" code={jsx} /></ZTabsPanel>
      <ZTabsPanel value="vue"><ZCodeBlock language="vue" code={jsx} /></ZTabsPanel>
      <ZTabsPanel value="angular"><ZCodeBlock language="html" code={html} /></ZTabsPanel>
    </ZTabs>
  );
}

```


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

## Documentation

# Code editor

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


## Examples & Implementation

### Case: basic

#### React
```tsx
import { useState } from 'react';
import { ZCodeEditor } from '@zelviora/react';

const initialCode = `function greet(name: string): string {
  return \`Hello, \${name}!\`;
}`;

export function CodeEditorBasic() {
  const [code, setCode] = useState(initialCode);

  return (
    <ZCodeEditor
      language="typescript"
      value={code}
      onZInput={(e: any) => setCode(e.target?.value ?? e.detail?.value ?? '')}
    />
  );
}

```

### Case: form

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZCodeEditor, ZStack } from '@zelviora/react';

export function CodeEditorForm() {
  const [submitted, setSubmitted] = useState<string | null>(null);

  const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
    e.preventDefault();
    const data = new FormData(e.currentTarget);
    setSubmitted(String(data.get('snippet') || ''));
  };

  return (
    <form className="demo-narrow" onSubmit={handleSubmit}>
      <ZStack gap="md">
        <ZCodeEditor
          name="snippet"
          label="Configuration script"
          hint="Enter JSON or JavaScript config snippet."
          language="javascript"
          required
          defaultValue={`{\n  "version": "1.0.0",\n  "enabled": true\n}`}
        />
        <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
          <ZButton type="submit">Submit code</ZButton>
          {submitted && <output>Submitted: {submitted.length} chars</output>}
        </ZStack>
      </ZStack>
    </form>
  );
}

```


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

#### React
```tsx
import { ZCodeHighlighter } from '@zelviora/react';

const code = `function calculateTotal(items) {
  return items.reduce((sum, item) => sum + item.price, 0);
}`;

export function CodeHighlighterBasic() {
  return <ZCodeHighlighter language="javascript" value={code} />;
}

```

### Case: line-numbers

#### React
```tsx
import { ZCodeHighlighter } from '@zelviora/react';

const code = `import { useState } from 'react';

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

export function CodeHighlighterLineNumbers() {
  return <ZCodeHighlighter language="typescript" lineNumbers value={code} />;
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZCollapsible, ZCollapsibleContent, ZCollapsibleTrigger, ZInput, ZStack } from '@zelviora/react';

export function CollapsibleControlled() {
  const [open, setOpen] = useState(false);
  const [log, setLog] = useState<string[]>([]);
  return (
    <ZStack gap="sm">
      <ZStack orientation="horizontal" gap="sm" alignItems="center">
        <ZButton variant="outline" tone="neutral" onClick={() => setOpen(!open)}>
          Toggle from state
        </ZButton>
        <span>open: {String(open)}</span>
      </ZStack>
      <ZCollapsible
        open={open}
        onZOpenChange={(e) => {
          setOpen(e.detail.open);
          setLog((l) => [...l, `${e.detail.open ? 'opened' : 'closed'} (${e.detail.reason})`]);
        }}
      >
        <ZCollapsibleTrigger>Advanced options</ZCollapsibleTrigger>
        <ZCollapsibleContent>
          <ZStack gap="sm">
            <ZInput label="Proxy server" name="proxy" />
            <ZInput label="Timeout (seconds)" name="timeout" />
          </ZStack>
        </ZCollapsibleContent>
      </ZCollapsible>
      <ul>
        {log.map((l, i) => (
          <li key={i}>{l}</li>
        ))}
      </ul>
    </ZStack>
  );
}

```

### Case: custom-indicator

#### React
```tsx
import { ZCollapsible, ZCollapsibleContent, ZCollapsibleTrigger, ZIcon, ZStack } from '@zelviora/react';

export function CollapsibleCustomIndicator() {
  return (
    <ZStack gap="md">
      <ZCollapsible defaultOpen>
        <ZCollapsibleTrigger>
          Release notes
          <ZIcon slot="indicator" name="add" />
        </ZCollapsibleTrigger>
        <ZCollapsibleContent>Version 2.4 adds dark mode and faster search.</ZCollapsibleContent>
      </ZCollapsible>
      <ZCollapsible disabled>
        <ZCollapsibleTrigger>Archived notes (disabled)</ZCollapsibleTrigger>
        <ZCollapsibleContent>Not available.</ZCollapsibleContent>
      </ZCollapsible>
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { ZCollapsible, ZCollapsibleContent, ZCollapsibleTrigger } from '@zelviora/react';

export function CollapsibleDefault() {
  return (
    <ZCollapsible>
      <ZCollapsibleTrigger>Show more</ZCollapsibleTrigger>
      <ZCollapsibleContent>
        <p>Orders ship from our Hanoi warehouse within two business days. Returns are accepted for 30 days.</p>
      </ZCollapsibleContent>
    </ZCollapsible>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZColorPicker, ZStack } from '@zelviora/react';

/** An opacity slider; the value is always #rrggbbaa (8 digits). */
export function ColorPickerAlpha() {
  const [value, setValue] = useState('#2563eb80');
  return (
    <ZStack className="demo-narrow">
      <ZColorPicker label="Overlay color" alpha value={value} onZInput={(e) => setValue(e.detail.value)} />
      <span>Value: {value}</span>
    </ZStack>
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZColorPicker, ZStack } from '@zelviora/react';

/** The app owns `value` (model event zInput, every drag step); the preview follows live and zChange is logged on commit. */
export function ColorPickerControlled() {
  const [value, setValue] = useState('#7c3aed');
  const [log, setLog] = useState<string[]>([]);
  const add = (line: string) => setLog((l) => [line, ...l].slice(0, 5));
  return (
    <ZStack className="demo-narrow">
      <ZColorPicker
        label="Background color"
        value={value}
        onZInput={(e) => setValue(e.detail.value)}
        onZChange={(e) => add(`zChange ${e.detail.value}`)}
        onZOpenChange={(e) => add(`zOpenChange ${e.detail.open} (${e.detail.reason})`)}
      />
      <ZColorPicker label="Preview" value={value} readonly />
      <ZStack orientation="horizontal" gap="sm" wrap>
        <ZButton variant="outline" tone="neutral" onClick={() => setValue('#dc2626')}>Set #dc2626</ZButton>
        <ZButton variant="outline" tone="neutral" onClick={() => setValue('')}>Clear</ZButton>
      </ZStack>
      <span>Value: {value || "''"}</span>
      <output>{log.join(' · ')}</output>
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZColorPicker } from '@zelviora/react';

const SWATCHES = ['#0f172a', '#2563eb', '#16a34a', '#f59e0b', '#dc2626', '#db2777'];

/** Component tokens resize the panel, the area and the swatches: see the `demo-color-picker-brand` rule in README. */
export function ColorPickerCustomization() {
  return <ZColorPicker className="demo-color-picker-brand" label="Tag color" inline defaultValue="#16a34a" swatches={SWATCHES} />;
}

```

### Case: default

#### React
```tsx
import { useState } from 'react';
import { ZColorPicker, ZStack } from '@zelviora/react';

/** Click the trigger: drag in the area, move the hue slider or type a hex code. */
export function ColorPickerDefault() {
  const [value, setValue] = useState('#2563eb');
  return (
    <ZStack className="demo-narrow">
      <ZColorPicker label="Primary color" value={value} onZInput={(e) => setValue(e.detail.value)} />
      <span>Value: {value || "''"}</span>
    </ZStack>
  );
}

```

### Case: form

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZColorPicker, ZField, ZStack } from '@zelviora/react';

/** Native form: the value is submitted as #rrggbb (FormData), required inside a field, reset restores defaults. */
export function ColorPickerForm() {
  const [sent, setSent] = useState('');
  return (
    <form
      className="demo-narrow"
      onSubmit={(e) => {
        e.preventDefault();
        setSent(JSON.stringify([...new FormData(e.currentTarget).entries()]));
      }}
    >
      <ZStack>
        <ZField label="Label color" hint="Used for category tags" required>
          <ZColorPicker name="label" placeholder="No color selected" required />
        </ZField>
        <ZColorPicker name="theme" label="Theme color" defaultValue="#0d9488" />
        <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
          <ZButton type="submit">Submit</ZButton>
          <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
        </ZStack>
        {sent && <output>{sent}</output>}
      </ZStack>
    </form>
  );
}

```

### Case: i18n

#### React
```tsx
import { ZColorPicker, ZConfigProvider, ZGrid } from '@zelviora/react';

/** Slider, area and button labels follow the locale; the panel is mirrored in RTL. */
export function ColorPickerI18n() {
  return (
    <ZGrid columns="1 sm:3" gap="md">
      <ZConfigProvider locale="vi">
        <ZColorPicker label="Tiếng Việt" defaultValue="#2563eb" />
      </ZConfigProvider>
      <ZConfigProvider locale="en">
        <ZColorPicker label="English" defaultValue="#2563eb" />
      </ZConfigProvider>
      <div dir="rtl" lang="ar-EG">
        <ZColorPicker label="العربية" defaultValue="#2563eb" />
      </div>
    </ZGrid>
  );
}

```

### Case: states

#### React
```tsx
import { ZColorPicker, ZGrid } from '@zelviora/react';

/** Empty (placeholder), filled, clearable, disabled, readonly and invalid; a status shown on the trigger. */
export function ColorPickerStates() {
  return (
    <ZGrid columns="1 sm:2" gap="md">
      <ZColorPicker label="Empty" placeholder="No color selected" />
      <ZColorPicker label="With value" defaultValue="#f97316" />
      <ZColorPicker label="Clearable" defaultValue="#f97316" clearable />
      <ZColorPicker label="Disabled" defaultValue="#f97316" disabled />
      <ZColorPicker label="Readonly" defaultValue="#f97316" readonly />
      <ZColorPicker label="Invalid" defaultValue="#f97316" invalid />
      <ZColorPicker label="Warning" defaultValue="#f97316" status="warning" />
      <ZColorPicker label="Success" defaultValue="#f97316" status="success" />
    </ZGrid>
  );
}

```

### Case: swatches

#### React
```tsx
import { ZColorPicker, ZGrid } from '@zelviora/react';

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. */
export function ColorPickerSwatches() {
  return (
    <ZGrid columns="1 md:2" gap="md">
      <ZColorPicker label="Brand palette" inline defaultValue="#2563eb" swatches={BRAND} />
      <ZColorPicker label="40 colors" defaultValue="#d92626" swatches={MANY} />
    </ZGrid>
  );
}

```

### Case: validation

#### React
```tsx
import { ZButton, ZColorPicker, ZStack } from '@zelviora/react';

/** A required color, and a wrong hex code (type "#12" then leave the field) that stays as bad input. */
export function ColorPickerValidation() {
  return (
    <form className="demo-narrow" onSubmit={(e) => e.preventDefault()}>
      <ZStack>
        <ZColorPicker name="brand" label="Brand color" placeholder="No color selected" required />
        <ZColorPicker name="accent" label="Try an invalid hex code" defaultValue="#0ea5e9" hint='Type "#12" in the hex field, then Tab' />
        <ZButton type="submit">Submit</ZButton>
      </ZStack>
    </form>
  );
}

```

### Case: variants

#### React
```tsx
import { ZColorPicker, ZGrid, ZStack } from '@zelviora/react';

/** Outline and filled triggers in every size, and the panel in the flow (`inline`). */
export function ColorPickerVariants() {
  return (
    <ZStack gap="lg">
      <ZGrid columns="1 sm:3" gap="md">
        <ZColorPicker label="Small" size="sm" defaultValue="#2563eb" />
        <ZColorPicker label="Medium" size="md" defaultValue="#2563eb" />
        <ZColorPicker label="Large" size="lg" defaultValue="#2563eb" />
        <ZColorPicker label="Small filled" size="sm" variant="filled" defaultValue="#16a34a" />
        <ZColorPicker label="Medium filled" size="md" variant="filled" defaultValue="#16a34a" />
        <ZColorPicker label="Large filled" size="lg" variant="filled" defaultValue="#16a34a" />
      </ZGrid>
      <ZColorPicker label="Inline" inline defaultValue="#db2777" />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZComboChart } from '@zelviora/react-chart';
import { comboData, comboSeries } from '../data.ts';

export function ComboChartBasic() {
  return (
    <ZComboChart
      heading="Revenue vs Operating Margin (%)"
      description="Quarterly revenue bars paired with a secondary-axis operating margin trend line."
      xKey="quarter" data={comboData} series={comboSeries}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/react';
import { ZComboChart } from '@zelviora/react-chart';
import { comboData, comboSeries } from '../data.ts';

export function ComboChartControlled() {
  const [hidden, setHidden] = useState<string[]>([]);
  const [selected, setSelected] = useState<string>('Click any chart element to inspect');

  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <ZButton
          size="sm"
          variant="outline"
          onClick={() => setHidden([])}
        >
          Show All Series
        </ZButton>
        <ZBadge tone="primary" variant="soft">
          {selected}
        </ZBadge>
        <ZText variant="muted" size="sm">
          Hidden: {hidden.length ? hidden.join(', ') : 'none'}
        </ZText>
      </ZStack>
      <ZComboChart
        heading="Revenue vs Operating Margin (%) (Interactive)"
        description="Quarterly revenue bars paired with a secondary-axis operating margin trend line."
        xKey="quarter" data={comboData} series={comboSeries}
        selectable
        hiddenSeries={hidden}
        onZSeriesToggle={(e) => setHidden(e.detail.hiddenSeries)}
        onZPointSelect={(e) =>
          setSelected(`Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`)
        }
      />
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZComboChart } from '@zelviora/react-chart';
import { comboData, comboSeries } from '../data.ts';

export function ComboChartCustomization() {
  return (
    <ZComboChart
      className="demo-chart-brand"
      description="Quarterly revenue bars paired with a secondary-axis operating margin trend line."
      valueFormat={{ maximumFractionDigits: 1 }}
      xKey="quarter" data={comboData} series={comboSeries} smooth dataZoom renderer="canvas"
    >
      <span slot="heading">Revenue vs Operating Margin (%) — Custom Theme Tokens &amp; Canvas</span>
    </ZComboChart>
  );
}

```

### Case: states

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZComboChart } from '@zelviora/react-chart';
import { comboData, comboSeries } from '../data.ts';

export function ComboChartStates() {
  return (
    <ZStack gap="lg">
      <ZComboChart
        heading="Loading State (aria-busy)"
        loading
        xKey="quarter" data={comboData} series={comboSeries}
      />
      <ZComboChart
        heading="Empty State"
        data={[]}
        series={comboSeries}
      />
      <ZComboChart
        heading="Expanded Accessible Data Table"
        description="Quarterly revenue bars paired with a secondary-axis operating margin trend line."
        showDataTable
        xKey="quarter" data={comboData} series={comboSeries}
      />
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZComboChart } from '@zelviora/react-chart';
import { comboData, comboSeries } from '../data.ts';

export function ComboChartVariants() {
  return (
    <ZStack gap="lg">
      <ZComboChart
        heading="Stacked Bars + Smooth Line"
        description="Stacked bars with smooth dual-axis line vs interactive dataZoom composite chart."
        xKey="quarter" data={comboData} series={comboSeries} stacked smooth
      />
      <ZComboChart
        heading="Zoomable Dual-Axis Combo"
        description="Stacked bars with smooth dual-axis line vs interactive dataZoom composite chart."
        xKey="quarter" data={comboData} series={comboSeries} dataZoom
      />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useEffect, useRef, useState } from 'react';
import { ZCombobox, ZStack } from '@zelviora/react';

/** 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. */
export function ComboboxAsync() {
  const [query, setQuery] = useState('');
  const [page, setPage] = useState(1);
  const [loading, setLoading] = useState(false);
  const timer = useRef<ReturnType<typeof setTimeout>>(undefined);
  useEffect(() => () => clearTimeout(timer.current), []);
  const results = search(query);
  const later = (fn: () => void) => {
    clearTimeout(timer.current);
    setLoading(true);
    timer.current = setTimeout(() => { fn(); setLoading(false); }, 300);
  };
  return (
    <ZStack className="demo-narrow">
      <ZCombobox
        label="Address"
        hint="Results come from the app; scroll to the end to load more"
        filter="none"
        loading={loading}
        options={results.slice(0, page * PAGE)}
        onZSearch={(e) => { const q = e.detail.query; later(() => { setQuery(q); setPage(1); }); }}
        onZLoadMore={() => { if (page * PAGE < results.length) later(() => setPage((p) => p + 1)); }}
      />
      <span>{results.length} matches, {Math.min(results.length, page * PAGE)} shown</span>
    </ZStack>
  );
}

```

### Case: custom

#### React
```tsx
import { useState } from 'react';
import { ZCombobox, ZSelectOption, ZStack } from '@zelviora/react';

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

/** Custom value (allow-custom-value), matched text styled through ::part(item-match), custom empty content. */
export function ComboboxCustom() {
  const [job, setJob] = useState<string | null>(null);
  return (
    <ZStack className="demo-narrow">
      <ZCombobox label="Occupation" hint="Type a job that is not listed, then Enter or leave the field" allowCustomValue clearable value={job} onZChange={(e) => setJob(e.detail.value)}>
        {JOBS.map((j) => <ZSelectOption key={j} value={j}>{j}</ZSelectOption>)}
      </ZCombobox>
      <span>Value: {job ?? 'none'}</span>
      <ZCombobox className="demo-combobox-match" label="Matched text underlined">
        {JOBS.map((j) => <ZSelectOption key={j} value={j}>{j}</ZSelectOption>)}
        <span slot="empty">No job matches; try "eng"</span>
      </ZCombobox>
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { useState } from 'react';
import { ZCombobox, ZSelectOption, ZStack } from '@zelviora/react';

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'],
];

/** Controlled value with an event log; typing "lis" finds "Lisbon". */
export function ComboboxDefault() {
  const [value, setValue] = useState<string | null>('dn');
  const [log, setLog] = useState<string[]>([]);
  const add = (line: string) => setLog((l) => [line, ...l].slice(0, 4));
  return (
    <ZStack className="demo-narrow">
      <ZCombobox
        label="City"
        hint='Type part of a name, for example "lis"'
        placeholder="Type to search"
        clearable
        value={value}
        onZChange={(e) => { setValue(e.detail.value); add(`zChange ${e.detail.value}`); }}
        onZSearch={(e) => add(`zSearch ${e.detail.query}`)}
      >
        {PROVINCES.map(([v, l]) => <ZSelectOption key={v} value={v}>{l}</ZSelectOption>)}
      </ZCombobox>
      <span>Value: {value ?? 'none'}</span>
      <output>{log.join(' · ')}</output>
    </ZStack>
  );
}

```

### Case: form

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZCombobox, ZField, ZSelectOption, ZStack } from '@zelviora/react';

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. */
export function ComboboxForm() {
  const [sent, setSent] = useState('');
  return (
    <form
      className="demo-narrow"
      onSubmit={(e) => {
        e.preventDefault();
        setSent(JSON.stringify([...new FormData(e.currentTarget).entries()]));
      }}
    >
      <ZStack>
        <ZField label="City" hint="Required" required>
          <ZCombobox name="province" required placeholder="Type to search">
            {PROVINCES.map(([v, l]) => <ZSelectOption key={v} value={v}>{l}</ZSelectOption>)}
          </ZCombobox>
        </ZField>
        <ZCombobox name="hometown" label="Hometown" defaultValue="hue">
          {PROVINCES.map(([v, l]) => <ZSelectOption key={v} value={v}>{l}</ZSelectOption>)}
        </ZCombobox>
        <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
          <ZButton type="submit">Submit</ZButton>
          <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
        </ZStack>
        {sent && <output>{sent}</output>}
      </ZStack>
    </form>
  );
}

```

### Case: i18n

#### React
```tsx
import { ZCombobox, ZConfigProvider } from '@zelviora/react';
import { provinces } from '../data-i18n.ts';

/** With locale `vi` the search ignores accents ("da nang" finds "Đà Nẵng") and the built-in texts are Vietnamese. */
export function ComboboxI18n() {
  return (
    <ZConfigProvider locale="vi">
      <div className="demo-narrow">
        <ZCombobox label="Tỉnh/thành" hint='Gõ không dấu, ví dụ "da nang"' placeholder="Gõ để tìm" clearable options={provinces} />
      </div>
    </ZConfigProvider>
  );
}

```

### Case: large

#### React
```tsx
import { useState } from 'react';
import { ZCombobox, ZStack } from '@zelviora/react';

const PRODUCTS = Array.from({ length: 5000 }, (_, i) => ({ value: `sku-${i + 1}`, label: `Product ${i + 1}` }));

/** 5 000 options as data: the list is virtual (`virtual="auto"` above 200 options), only the rows in view are rendered. */
export function ComboboxLarge() {
  const [value, setValue] = useState<string | null>(null);
  return (
    <ZStack className="demo-narrow">
      <ZCombobox label="Product" placeholder="Type a number, for example 4321" options={PRODUCTS} clearable onZChange={(e) => setValue(e.detail.value)} />
      <span>Value: {value ?? 'none'}</span>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZCommandGroup, ZCommandItem, ZCommandPalette, ZStack, ZText } from '@zelviora/react';

/** Dialog opened by its trigger or the Mod+K hotkey (off unless set). */
export function CommandPaletteDefault() {
  const [last, setLast] = useState('nothing yet');
  return (
    <ZStack orientation="horizontal" wrap alignItems="center" gap="md">
      <ZCommandPalette hotkey="Mod+K" onZSelect={(e) => setLast(e.detail.item.label)}>
        <ZButton slot="trigger" variant="outline" tone="neutral">
          Commands (Ctrl/⌘ K)
        </ZButton>
        <ZCommandGroup heading="Navigation">
          <ZCommandItem value="dashboard" shortcut="Mod+1">Dashboard</ZCommandItem>
          <ZCommandItem value="settings" keywords="preferences,options" shortcut="Mod+,">Settings</ZCommandItem>
          <ZCommandItem value="billing" disabled>Billing</ZCommandItem>
        </ZCommandGroup>
        <ZCommandGroup heading="Actions">
          <ZCommandItem value="new-project">New project</ZCommandItem>
          <ZCommandItem value="theme" keywords="dark,light">Toggle theme</ZCommandItem>
          <ZCommandItem value="close-tab">Close tab</ZCommandItem>
        </ZCommandGroup>
        <span slot="footer">↑↓ to move · Enter to run · Esc to close</span>
      </ZCommandPalette>
      <ZText variant="muted">Last command: {last}</ZText>
    </ZStack>
  );
}

```

### Case: i18n

#### React
```tsx
import { ZButton, ZCommandGroup, ZCommandItem, ZCommandPalette } from '@zelviora/react';

/** `lang="vi"`: labels and built-in texts are Vietnamese; "dong" matches "Đóng tab". */
export function CommandPaletteI18n() {
  return (
    <ZCommandPalette lang="vi">
      <ZButton slot="trigger" variant="outline" tone="neutral">Lệnh</ZButton>
      <ZCommandGroup heading="Thao tác">
        <ZCommandItem value="new-project">Dự án mới</ZCommandItem>
        <ZCommandItem value="settings" keywords="cai dat">Cài đặt</ZCommandItem>
        <ZCommandItem value="close-tab">Đóng tab</ZCommandItem>
      </ZCommandGroup>
    </ZCommandPalette>
  );
}

```

### Case: inline

#### React
```tsx
import { useState, type ComponentProps } from 'react';
import { ZCommandPalette } from '@zelviora/react';

type ZCommandPaletteItem = NonNullable<ComponentProps<typeof ZCommandPalette>['items']>[number];

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. */
export function CommandPaletteInline() {
  const [items, setItems] = useState(ALL);
  const [loading, setLoading] = useState(false);
  return (
    <div className="demo-narrow">
      <ZCommandPalette
        inline
        label="Search the workspace"
        disableFilter
        items={items}
        loading={loading}
        onZSearch={(e) => {
          const q = e.detail.query.trim().toLowerCase();
          setLoading(true);
          setTimeout(() => {
            setItems(ALL.filter((i) => !q || i.label.toLowerCase().includes(q) || i.keywords?.some((k) => k.includes(q))));
            setLoading(false);
          }, 400);
        }}
      >
        <span slot="empty">Nothing found. Try “clients”.</span>
      </ZCommandPalette>
    </div>
  );
}

```


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

## Documentation

# Condition Builder Angular Demos

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


## Examples & Implementation

### Case: basic

#### React
```tsx
import { useState } from 'react';
import {
  ZButton,
  ZConditionBuilder,
  ZConditionBuilderExpression,
  ZConditionBuilderPredicate,
  ZIcon,
  ZIconButton,
  ZInput,
  ZText,
} from '@zelviora/react';

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' },
];

export function ConditionBuilderBasic() {
  const [conditions, setConditions] = useState<ConditionItem[]>([
    { id: '1', field: 'Username', operator: 'eq', value: 'alex' },
    { id: '2', field: 'Email domain', operator: 'contains', value: '@example.com' },
  ]);

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

  const removeCondition = (id: string) => {
    setConditions((prev) => prev.filter((c) => c.id !== id));
  };

  const updateOperator = (id: string, operator: string) => {
    setConditions((prev) =>
      prev.map((c) => (c.id === id ? { ...c, operator } : c))
    );
  };

  const updateValue = (id: string, value: string) => {
    setConditions((prev) =>
      prev.map((c) => (c.id === id ? { ...c, value } : c))
    );
  };

  return (
    <ZConditionBuilder>
      <ZConditionBuilderPredicate conditionOperator="and" vertical>
        {conditions.length === 0 ? (
          <ZText variant="muted" size="sm">No conditions defined.</ZText>
        ) : (
          conditions.map((item) => (
            <ZConditionBuilderExpression
              key={item.id}
              operators={OPERATORS}
              operatorValue={item.operator}
              onZOperatorChange={(e) => updateOperator(item.id, e.detail.value)}
            >
              <ZInput
                placeholder={`Enter ${item.field.toLowerCase()}`}
                value={item.value}
                className="demo-cb-input"
                onZInput={(e: any) => updateValue(item.id, e.target?.value ?? '')}
              />
              <ZIconButton
                label="Delete condition"
                variant="ghost"
                tone="destructive"
                size="sm"
                onClick={() => removeCondition(item.id)}
              >
                <ZIcon name="delete" />
              </ZIconButton>
            </ZConditionBuilderExpression>
          ))
        )}

        <div slot="end">
          <ZButton size="sm" variant="outline" onClick={addCondition}>
            <ZIcon slot="icon-start" name="add" />
            Add condition
          </ZButton>
        </div>
      </ZConditionBuilderPredicate>
    </ZConditionBuilder>
  );
}

```

### Case: nested

#### React
```tsx
import { useState } from 'react';
import {
  ZButton,
  ZConditionBuilder,
  ZConditionBuilderCompoundExpression,
  ZConditionBuilderExpression,
  ZConditionBuilderPredicate,
  ZIcon,
  ZIconButton,
  ZInput,
  ZNumberInput,
} from '@zelviora/react';

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' },
];

export function ConditionBuilderNested() {
  const [ageRules, setAgeRules] = useState<Rule[]>([
    { id: 'age-1', operator: 'gt', value: 18 },
    { id: 'age-2', operator: 'lt', value: 65 },
  ]);

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

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

  const removeAgeRule = (id: string) => {
    setAgeRules((prev) => prev.filter((r) => r.id !== id));
  };

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

  const removeDeptRule = (id: string) => {
    setDeptRules((prev) => prev.filter((r) => r.id !== id));
  };

  return (
    <ZConditionBuilder>
      <ZConditionBuilderPredicate conditionOperator="and" vertical>
        {ageRules.length > 0 && (
          <ZConditionBuilderCompoundExpression
            fieldLabel="Age"
            fieldName="age"
            conditionOperator="or"
          >
            {ageRules.map((rule) => (
              <ZConditionBuilderExpression
                key={rule.id}
                operators={NUM_OPS}
                operatorValue={rule.operator}
              >
                <ZNumberInput defaultValue={rule.value} className="demo-cb-number" />
                <ZIconButton
                  label="Delete condition"
                  variant="ghost"
                  tone="destructive"
                  size="sm"
                  onClick={() => removeAgeRule(rule.id)}
                >
                  <ZIcon name="delete" />
                </ZIconButton>
              </ZConditionBuilderExpression>
            ))}
            <div slot="end">
              <ZButton size="sm" variant="ghost" onClick={addAgeRule}>
                <ZIcon slot="icon-start" name="add" />
                Add age rule
              </ZButton>
            </div>
          </ZConditionBuilderCompoundExpression>
        )}

        {deptRules.length > 0 && (
          <ZConditionBuilderCompoundExpression
            fieldLabel="Department"
            fieldName="dept"
            conditionOperator="or"
          >
            {deptRules.map((rule) => (
              <ZConditionBuilderExpression
                key={rule.id}
                operators={STRING_OPS}
                operatorValue={rule.operator}
              >
                <ZInput
                  placeholder="Department name"
                  defaultValue={rule.value}
                  className="demo-cb-input"
                />
                <ZIconButton
                  label="Delete condition"
                  variant="ghost"
                  tone="destructive"
                  size="sm"
                  onClick={() => removeDeptRule(rule.id)}
                >
                  <ZIcon name="delete" />
                </ZIconButton>
              </ZConditionBuilderExpression>
            ))}
            <div slot="end">
              <ZButton size="sm" variant="ghost" onClick={addDeptRule}>
                <ZIcon slot="icon-start" name="add" />
                Add department rule
              </ZButton>
            </div>
          </ZConditionBuilderCompoundExpression>
        )}
      </ZConditionBuilderPredicate>
    </ZConditionBuilder>
  );
}

```


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

#### React
```tsx
import { ZButton, ZConfigProvider, ZSpinner, ZStack } from '@zelviora/react';

export function ConfigProviderBasic() {
  return (
    <ZConfigProvider>
      <ZStack orientation="horizontal" alignItems="center" gap="md" wrap>
        <ZButton>Save</ZButton>
        <ZButton variant="outline" tone="neutral">Cancel</ZButton>
        <ZSpinner showLabel />
      </ZStack>
    </ZConfigProvider>
  );
}

```

### Case: contrast

#### React
```tsx
import { ZButton, ZCard, ZConfigProvider, ZGrid, ZInput, ZStack } from '@zelviora/react';

/** `contrast="more"` next to the default region; it changes colors only when the brand enables theme.highContrast. */
export function ConfigProviderContrast() {
  return (
    <ZGrid columns="1 sm:2" gap="md" alignItems="start">
      {([undefined, 'more'] as const).map((contrast) => (
        <ZConfigProvider key={contrast ?? 'default'} contrast={contrast}>
          <ZCard heading={contrast ? 'More contrast' : 'Default contrast'}>
            <ZStack gap="sm">
              <ZInput label="Email" placeholder="name@example.com" hint="We never share your email" />
              <ZStack orientation="horizontal" gap="sm" wrap>
                <ZButton>Save</ZButton>
                <ZButton variant="outline" tone="neutral">Cancel</ZButton>
              </ZStack>
            </ZStack>
          </ZCard>
        </ZConfigProvider>
      ))}
    </ZGrid>
  );
}

```

### Case: density

#### React
```tsx
import { ZButton, ZConfigProvider, ZStack, ZTable } from '@zelviora/react';

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

export function ConfigProviderDensity() {
  return (
    <ZStack gap="lg">
      {(['compact', 'default', 'comfortable'] as const).map((density) => (
        <ZConfigProvider key={density} density={density}>
          <ZStack gap="sm" alignItems="start">
            <ZButton>{density}</ZButton>
            <ZTable caption={`Tasks (${density})`} columns={columns} rows={rows} />
          </ZStack>
        </ZConfigProvider>
      ))}
    </ZStack>
  );
}

```

### Case: disabled

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZConfigProvider, ZInput, ZSelect, ZSelectOption, ZStack, ZSwitch } from '@zelviora/react';

/** `disabled` turns the whole region off like a disabled fieldset: no focus, no submit; the toggle stays outside. */
export function ConfigProviderDisabled() {
  const [disabled, setDisabled] = useState(true);
  const [sent, setSent] = useState('');
  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <ZButton variant="outline" tone="neutral" onClick={() => setDisabled(!disabled)}>
          {disabled ? 'Enable region' : 'Disable region'}
        </ZButton>
        <span>disabled: {String(disabled)}</span>
      </ZStack>
      <ZConfigProvider disabled={disabled}>
        <form
          className="demo-narrow"
          onSubmit={(e) => {
            e.preventDefault();
            setSent(JSON.stringify([...new FormData(e.currentTarget).entries()]));
          }}
        >
          <ZStack>
            <ZInput label="Full name" name="name" defaultValue="An Nguyen" />
            <ZSelect label="Plan" name="plan" defaultValue="team">
              <ZSelectOption value="starter">Starter</ZSelectOption>
              <ZSelectOption value="team">Team</ZSelectOption>
            </ZSelect>
            <ZSwitch name="newsletter" defaultChecked>Newsletter</ZSwitch>
            <ZButton type="submit">Submit</ZButton>
            {sent && <output>{sent}</output>}
          </ZStack>
        </form>
      </ZConfigProvider>
    </ZStack>
  );
}

```

### Case: form

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZConfigProvider, ZField, ZInput, ZSelect, ZSelectOption, ZStack } from '@zelviora/react';

/** A native form inside a provider with locale="en": required fields report built-in English messages on submit. */
export function ConfigProviderForm() {
  const [sent, setSent] = useState('');
  return (
    <ZConfigProvider locale="en">
      <form
        className="demo-narrow"
        onSubmit={(e) => {
          e.preventDefault();
          setSent(JSON.stringify([...new FormData(e.currentTarget).entries()]));
        }}
      >
        <ZStack>
          <ZField label="Full name" required>
            <ZInput name="name" required />
          </ZField>
          <ZField label="Email" required>
            <ZInput name="email" type="email" required />
          </ZField>
          <ZField label="Country" required>
            <ZSelect name="country" required>
              <ZSelectOption value="us">United States</ZSelectOption>
              <ZSelectOption value="gb">United Kingdom</ZSelectOption>
              <ZSelectOption value="sg">Singapore</ZSelectOption>
            </ZSelect>
          </ZField>
          <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
            <ZButton type="submit">Submit</ZButton>
            <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
          </ZStack>
          {sent && <output>{sent}</output>}
        </ZStack>
      </form>
    </ZConfigProvider>
  );
}

```

### Case: i18n

#### React
```tsx
import { ZButton, ZCard, ZConfigProvider, ZGrid, ZInput, ZStack } from '@zelviora/react';

/** The provider locale drives built-in strings: submit an empty form to see the validation message in each language. */
export function ConfigProviderI18n() {
  return (
    <ZGrid columns="1 sm:2" gap="md" alignItems="start">
      <ZConfigProvider locale="en">
        <ZCard heading="English">
          <form onSubmit={(e) => e.preventDefault()}>
            <ZStack gap="sm">
              <ZInput label="Full name" name="name" required />
              <ZButton type="submit">Submit</ZButton>
            </ZStack>
          </form>
        </ZCard>
      </ZConfigProvider>
      <ZConfigProvider locale="vi">
        <ZCard heading="Tiếng Việt">
          <form onSubmit={(e) => e.preventDefault()}>
            <ZStack gap="sm">
              <ZInput label="Họ và tên" name="name" required />
              <ZButton type="submit">Gửi</ZButton>
            </ZStack>
          </form>
        </ZCard>
      </ZConfigProvider>
    </ZGrid>
  );
}

```

### Case: messages

#### React
```tsx
import { ZConfigProvider, ZSpinner, ZStack, ZTable } from '@zelviora/react';

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). */
export function ConfigProviderMessages() {
  return (
    <ZConfigProvider messages={messages}>
      <ZStack gap="md">
        <ZSpinner showLabel />
        <ZTable caption="Results" columns={[{ key: 'name', header: 'Name' }]} rows={[]} />
      </ZStack>
    </ZConfigProvider>
  );
}

```

### Case: motion

#### React
```tsx
import { ZCard, ZCollapsible, ZCollapsibleContent, ZCollapsibleTrigger, ZConfigProvider, ZGrid } from '@zelviora/react';

/** `motion="reduce"` applies the reduced-motion tokens to its region only: its collapsible opens without animation. */
export function ConfigProviderMotion() {
  return (
    <ZGrid columns="1 sm:2" gap="md" alignItems="start">
      <ZConfigProvider>
        <ZCard heading="Default motion">
          <ZCollapsible>
            <ZCollapsibleTrigger>Shipping details</ZCollapsibleTrigger>
            <ZCollapsibleContent>
              <p>Orders ship within two business days. Returns are accepted for 30 days.</p>
            </ZCollapsibleContent>
          </ZCollapsible>
        </ZCard>
      </ZConfigProvider>
      <ZConfigProvider motion="reduce">
        <ZCard heading="Reduced motion">
          <ZCollapsible>
            <ZCollapsibleTrigger>Shipping details</ZCollapsibleTrigger>
            <ZCollapsibleContent>
              <p>Orders ship within two business days. Returns are accepted for 30 days.</p>
            </ZCollapsibleContent>
          </ZCollapsible>
        </ZCard>
      </ZConfigProvider>
    </ZGrid>
  );
}

```

### Case: nested

#### React
```tsx
import { ZButton, ZCard, ZConfigProvider, ZGrid, ZGridItem, ZStack, ZTable } from '@zelviora/react';

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. */
export function ConfigProviderNested() {
  return (
    <ZConfigProvider theme="light">
      <ZGrid columns={4} alignItems="start">
        <ZConfigProvider theme="dark">
          <ZCard size="sm">
            <nav aria-label="Sidebar">
              <ZStack gap="sm">
                <ZButton variant="ghost" tone="neutral">Dashboard</ZButton>
                <ZButton variant="ghost" tone="neutral">Reports</ZButton>
              </ZStack>
            </nav>
          </ZCard>
        </ZConfigProvider>
        <ZGridItem span={3}>
          <ZConfigProvider density="compact">
            <ZTable caption="Team" columns={columns} rows={rows} />
          </ZConfigProvider>
        </ZGridItem>
      </ZGrid>
    </ZConfigProvider>
  );
}

```

### Case: playground

#### React
```tsx
import { useState } from 'react';
import {
  ZButton,
  ZCard,
  ZCollapsible,
  ZCollapsibleContent,
  ZCollapsibleTrigger,
  ZConfigProvider,
  ZDatePicker,
  ZGrid,
  ZInput,
  ZSelect,
  ZSelectOption,
  ZStack,
  ZSwitch,
} from '@zelviora/react';

/** 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. */
export function ConfigProviderPlayground() {
  const [config, setConfig] = useState(initial);
  const [disabled, setDisabled] = useState(false);
  const [reduceMotion, setReduceMotion] = useState(false);
  const [moreContrast, setMoreContrast] = useState(false);
  return (
    <ZStack gap="lg">
      <ZGrid columns="2 sm:3" gap="md">
        {selects.map((s) => (
          <ZSelect
            key={s.key}
            label={s.label}
            size="sm"
            value={config[s.key]}
            onZChange={(e) => setConfig({ ...config, [s.key]: String(e.detail.value ?? s.options[0]) })}
          >
            {s.options.map((o) => (
              <ZSelectOption key={o} value={o}>{o}</ZSelectOption>
            ))}
          </ZSelect>
        ))}
      </ZGrid>
      <ZStack orientation="horizontal" gap="md" wrap>
        <ZSwitch checked={disabled} onZChange={(e) => setDisabled(e.detail.checked)}>Disabled</ZSwitch>
        <ZSwitch checked={reduceMotion} onZChange={(e) => setReduceMotion(e.detail.checked)}>Reduce motion</ZSwitch>
        <ZSwitch checked={moreContrast} onZChange={(e) => setMoreContrast(e.detail.checked)}>More contrast</ZSwitch>
      </ZStack>
      <ZConfigProvider
        theme={config.theme as 'light' | 'dark' | 'system'}
        density={config.density as 'default' | 'compact' | 'comfortable'}
        size={config.size as 'sm' | 'md' | 'lg'}
        variant={config.variant as 'outline' | 'filled'}
        locale={config.locale}
        dir={config.dir}
        disabled={disabled}
        motion={reduceMotion ? 'reduce' : undefined}
        contrast={moreContrast ? 'more' : undefined}
      >
        <ZCard heading="Sample form">
          <form className="demo-narrow" onSubmit={(e) => e.preventDefault()}>
            <ZStack>
              <ZInput label="Full name" name="name" required />
              <ZSelect label="Plan" name="plan" defaultValue="team">
                <ZSelectOption value="starter">Starter</ZSelectOption>
                <ZSelectOption value="team">Team</ZSelectOption>
                <ZSelectOption value="enterprise">Enterprise</ZSelectOption>
              </ZSelect>
              <ZDatePicker label="Start date" name="start" today="2026-10-02" defaultValue="2026-10-15" />
              <ZCollapsible>
                <ZCollapsibleTrigger>Plan details</ZCollapsibleTrigger>
                <ZCollapsibleContent>
                  <p>Team includes ten seats, shared projects and priority support.</p>
                </ZCollapsibleContent>
              </ZCollapsible>
              <ZButton type="submit">Submit</ZButton>
            </ZStack>
          </form>
        </ZCard>
      </ZConfigProvider>
    </ZStack>
  );
}

```

### Case: preset

#### React
```tsx
import { ZBadge, ZButton, ZCard, ZConfigProvider, ZGrid, ZInput, ZStack } from '@zelviora/react';
import type { PresetName } from '@zelviora/react';

// 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. */
export function ConfigProviderPreset() {
  return (
    <ZGrid columns="1 sm:3" gap="md">
      {regions.map((r) => (
        <ZConfigProvider key={r.key} preset={r.preset} theme={r.theme}>
          <ZCard size="sm">
            <ZStack gap="sm">
              <ZBadge tone="neutral">{r.title}</ZBadge>
              <ZInput label="Email" placeholder="name@example.com" />
              <ZStack orientation="horizontal" gap="sm">
                <ZButton>Save</ZButton>
                <ZButton variant="outline" tone="neutral">Cancel</ZButton>
              </ZStack>
            </ZStack>
          </ZCard>
        </ZConfigProvider>
      ))}
    </ZGrid>
  );
}

```

### Case: rtl

#### React
```tsx
import { ZButton, ZConfigProvider, ZIcon, ZStack, ZTable } from '@zelviora/react';

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. */
export function ConfigProviderRtl() {
  return (
    <ZConfigProvider dir="rtl" lang="ar">
      <ZStack gap="md" alignItems="start">
        <ZButton>
          <ZIcon slot="icon-start" name="arrow_back" />
          حفظ
        </ZButton>
        <ZTable caption="الطلبات" columns={columns} rows={rows} />
      </ZStack>
    </ZConfigProvider>
  );
}

```

### Case: runtime

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZCard, ZConfigProvider, ZSpinner, ZStack, ZTable } from '@zelviora/react';

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. */
export function ConfigProviderRuntime() {
  const [locale, setLocale] = useState<'en' | 'ar'>('en');
  const [theme, setTheme] = useState<'light' | 'dark'>('light');
  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" gap="sm" wrap>
        <ZButton variant="outline" tone="neutral" onClick={() => setLocale(locale === 'en' ? 'ar' : 'en')}>
          Locale: {locale}
        </ZButton>
        <ZButton variant="outline" tone="neutral" onClick={() => setTheme(theme === 'light' ? 'dark' : 'light')}>
          Theme: {theme}
        </ZButton>
      </ZStack>
      <ZConfigProvider locale={locale} theme={theme}>
        {/* The card paints the themed surface, so the theme switch shows around the content. */}
        <ZCard>
          <ZStack gap="md">
            <ZSpinner showLabel />
            <ZTable caption="Order" columns={columns} rows={rows} />
            <ZTable caption="Empty order" columns={columns} rows={[]} />
          </ZStack>
        </ZCard>
      </ZConfigProvider>
    </ZStack>
  );
}

```

### Case: sizes

#### React
```tsx
import { ZButton, ZConfigProvider, ZStack } from '@zelviora/react';

export function ConfigProviderSizes() {
  return (
    <ZStack gap="md" alignItems="start">
      {(['sm', 'md', 'lg'] as const).map((size) => (
        <ZConfigProvider key={size} size={size}>
          <ZStack orientation="horizontal" gap="sm" wrap>
            <ZButton>Size {size}</ZButton>
            <ZButton size="md" variant="outline" tone="neutral">Own size md</ZButton>
          </ZStack>
        </ZConfigProvider>
      ))}
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZConfigProvider, ZDatePicker, ZInput, ZSelect, ZSelectOption, ZStack } from '@zelviora/react';

/** `variant="filled"` is the default of every descendant field; a field with its own variant keeps it. */
export function ConfigProviderVariants() {
  return (
    <ZConfigProvider variant="filled">
      <ZStack className="demo-narrow">
        <ZInput label="Full name" defaultValue="An Nguyen" />
        <ZSelect label="Plan" defaultValue="team">
          <ZSelectOption value="starter">Starter</ZSelectOption>
          <ZSelectOption value="team">Team</ZSelectOption>
        </ZSelect>
        <ZDatePicker label="Start date" today="2026-10-02" defaultValue="2026-10-15" />
        <ZInput label="Own variant outline" variant="outline" defaultValue="Keeps its outline" />
      </ZStack>
    </ZConfigProvider>
  );
}

```


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

#### React
```tsx
import { ZContainer } from '@zelviora/react';

/** Default: at most 64rem wide (lg), centered, with md inline padding. */
export function ContainerBasic() {
  return (
    <ZContainer>
      <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>
    </ZContainer>
  );
}

```

### Case: composition

#### React
```tsx
import { ZCard, ZContainer, ZGrid } from '@zelviora/react';

const stats = [
  { heading: 'Revenue', value: '1.2B VND' },
  { heading: 'Orders', value: '3,410' },
  { heading: 'Customers', value: '982' },
];

/** The grid columns follow the container (md, 48rem): three columns from sm, one when the container is narrower. */
export function ContainerComposition() {
  return (
    <ZContainer size="md">
      <ZGrid columns="1 sm:3">
        {stats.map((s) => (
          <ZCard key={s.heading} heading={s.heading} size="sm">
            {s.value}
          </ZCard>
        ))}
      </ZGrid>
    </ZContainer>
  );
}

```

### Case: landmark

#### React
```tsx
import { ZContainer, ZStack } from '@zelviora/react';

/** landmarkRole sets the role on the host; a region needs a label. */
export function ContainerLandmark() {
  return (
    <ZContainer size="sm" landmarkRole="region" label="Shipping policy">
      <ZStack gap="sm">
        <p>Orders ship within two business days.</p>
        <p>Returns are free for 30 days.</p>
      </ZStack>
    </ZContainer>
  );
}

```

### Case: sizes

#### React
```tsx
import { ZCard, ZContainer, ZStack } from '@zelviora/react';

const sizes = ['sm', 'md', 'lg', 'xl', 'full'] as const;

/** Maximum widths: sm 40rem, md 48rem, lg 64rem, xl 80rem, full without limit. */
export function ContainerSizes() {
  return (
    <ZStack gap="sm">
      {sizes.map((size) => (
        <ZContainer key={size} size={size} padding="none">
          <ZCard variant="soft" size="sm">size="{size}"</ZCard>
        </ZContainer>
      ))}
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useRef, useState } from 'react';
import { ZButton, ZContextMenu, ZMenuItem, ZStack } from '@zelviora/react';

/**
 * 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.
 */
export function ContextMenuControlled() {
  const menu = useRef<HTMLZContextMenuElement>(null);
  const [open, setOpen] = useState(false);
  const [file, setFile] = useState('');
  return (
    <ZStack gap="md">
      <ZContextMenu
        ref={menu}
        label="Row actions"
        open={open}
        onZOpenChange={(e) => setOpen(e.detail.open)}
        onZBeforeOpen={(e) => {
          const row = (e.detail.target as Element | null)?.closest?.('[data-file]');
          if (e.detail.reason !== 'programmatic' && !row) e.preventDefault();
          else setFile(row?.getAttribute('data-file') ?? '');
        }}
      >
        <ZStack slot="target" gap="xs" className="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>
        </ZStack>
        <ZMenuItem value="open">Open {file}</ZMenuItem>
        <ZMenuItem value="delete" tone="destructive">Delete {file}</ZMenuItem>
      </ZContextMenu>
      <ZStack orientation="horizontal" wrap alignItems="center" gap="md">
        <ZButton
          variant="outline"
          tone="neutral"
          onClick={(e) => {
            const r = e.currentTarget.getBoundingClientRect();
            void menu.current?.showAt(r.left, r.bottom);
          }}
        >
          showAt()
        </ZButton>
        <span>{open ? 'Open' : 'Closed'}</span>
      </ZStack>
      <ZContextMenu label="Disabled" disabled>
        <div slot="target" className="demo-context-area">Disabled: the browser menu shows</div>
        <ZMenuItem value="never">Never shown</ZMenuItem>
      </ZContextMenu>
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { useState } from 'react';
import { ZContextMenu, ZMenuItem, ZMenuSeparator, ZStack } from '@zelviora/react';

/** Right click, long-press (touch) or focus the area and press Shift+F10 / the Menu key. */
export function ContextMenuDefault() {
  const [last, setLast] = useState('');
  return (
    <ZStack gap="sm">
      <ZContextMenu label="File actions" onZSelect={(e) => setLast(e.detail.value)}>
        <div slot="target" tabIndex={0} className="demo-context-area">report.pdf — right click here</div>
        <ZMenuItem value="open">Open<kbd slot="shortcut">⏎</kbd></ZMenuItem>
        <ZMenuItem value="rename">Rename<kbd slot="shortcut">F2</kbd></ZMenuItem>
        <ZMenuItem value="duplicate">Duplicate</ZMenuItem>
        <ZMenuItem value="share" disabled>Share</ZMenuItem>
        <ZMenuSeparator />
        <ZMenuItem value="delete" tone="destructive">Delete</ZMenuItem>
      </ZContextMenu>
      <span>{last ? `Last action: ${last}` : 'No action yet'}</span>
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { useState } from 'react';
import {
  ZContextMenu, ZMenuCheckboxItem, ZMenuItem, ZMenuLabel, ZMenuRadioGroup, ZMenuRadioItem, ZMenuSeparator, ZMenuSub, ZStack,
} from '@zelviora/react';

/** Checkbox and radio items, a submenu; the menu flips near the viewport edges. */
export function ContextMenuVariants() {
  const [grid, setGrid] = useState(true);
  const [zoom, setZoom] = useState('100');
  return (
    <ZStack gap="sm">
      <ZContextMenu label="Canvas">
        <div slot="target" tabIndex={0} className="demo-context-area">Canvas — right click near the edges too</div>
        <ZMenuCheckboxItem checked={grid} keepOpenOnSelect onZChange={(e) => setGrid(e.detail.checked)}>Show grid</ZMenuCheckboxItem>
        <ZMenuSeparator />
        <ZMenuRadioGroup value={zoom} onZChange={(e) => setZoom(e.detail.value)}>
          <ZMenuLabel>Zoom</ZMenuLabel>
          <ZMenuRadioItem value="50">50%</ZMenuRadioItem>
          <ZMenuRadioItem value="100">100%</ZMenuRadioItem>
          <ZMenuRadioItem value="200">200%</ZMenuRadioItem>
        </ZMenuRadioGroup>
        <ZMenuSeparator />
        <ZMenuSub>
          <ZMenuItem slot="trigger">Arrange</ZMenuItem>
          <ZMenuItem value="front">Bring to front</ZMenuItem>
          <ZMenuItem value="back">Send to back</ZMenuItem>
        </ZMenuSub>
      </ZContextMenu>
      <span>{`Grid ${grid ? 'on' : 'off'}, zoom ${zoom}%`}</span>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZCropper, ZSegmented, ZSegmentedItem, ZStack } from '@zelviora/react';
import { aspectDefault, aspectLabel, aspectOption, aspectOptions, sampleAlt, sampleImage } from '../data.ts';

/** A fixed `aspectRatio` (one size slider instead of two) and the circle `shape` of an avatar (the value stays a rectangle). */
export function CropperAspect() {
  const [preset, setPreset] = useState<string>(aspectDefault);
  const { aspectRatio, shape } = aspectOption(preset);
  return (
    <ZStack gap="sm" className="demo-narrow">
      <ZSegmented label={aspectLabel} value={preset} onZChange={(e) => setPreset(e.detail.value)}>
        {aspectOptions.map((o) => <ZSegmentedItem key={o.value} value={o.value}>{o.label}</ZSegmentedItem>)}
      </ZSegmented>
      <ZCropper src={sampleImage} alt={sampleAlt} aspectRatio={aspectRatio} shape={shape} disableRotate />
    </ZStack>
  );
}

```

### Case: controlled

#### React
```tsx
import { useEffect, useRef, useState } from 'react';
import { ZButton, ZCropper, ZGrid, ZStack, ZText } from '@zelviora/react';
import {
  controlledInitial, controlledPresets, previewAlt, previewEmpty, previewHeading, previewMaxWidth, sampleAlt, sampleImage,
  valueLog, type CropArea,
} from '../data.ts';

/** The app holds `value` (pixels of the original image) and updates it on `zInput`; `zChange` refreshes a preview. */
export function CropperControlled() {
  const cropper = useRef<HTMLZCropperElement>(null);
  const [value, setValue] = useState<CropArea>(controlledInitial);
  const [preview, setPreview] = useState<string>();
  useEffect(() => () => { if (preview) URL.revokeObjectURL(preview); }, [preview]);
  const refresh = async () => {
    const blob = await cropper.current?.getCroppedBlob({ maxWidth: previewMaxWidth }).catch(() => undefined);
    if (blob) setPreview(URL.createObjectURL(blob));
  };
  return (
    <ZGrid columns="1 sm:2" gap="lg">
      <ZStack gap="sm">
        <ZStack orientation="horizontal" gap="sm" wrap>
          {controlledPresets.map((p) => (
            <ZButton key={p.label} size="sm" variant="outline" tone="neutral" onClick={() => setValue(p.value)}>{p.label}</ZButton>
          ))}
        </ZStack>
        <ZCropper
          ref={cropper}
          src={sampleImage}
          alt={sampleAlt}
          value={value}
          onZInput={(e) => setValue(e.detail.value)}
          onZChange={(e) => { setValue(e.detail.value); void refresh(); }}
          onZLoad={refresh}
        />
      </ZStack>
      <ZStack gap="sm">
        <ZText variant="strong">{previewHeading}</ZText>
        {preview ? <img src={preview} alt={previewAlt} /> : <ZText variant="muted">{previewEmpty}</ZText>}
        <ZText variant="muted" size="sm">{valueLog(value)}</ZText>
      </ZStack>
    </ZGrid>
  );
}

```

### Case: default

#### React
```tsx
import { useState } from 'react';
import { ZCropper, ZStack, ZText } from '@zelviora/react';
import { changeLog, emptyLog, loadLog, sampleAlt, sampleImage } from '../data.ts';

/**
 * 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.
 */
export function CropperDefault() {
  const [log, setLog] = useState(emptyLog);
  return (
    <ZStack gap="sm" className="demo-narrow">
      <ZCropper
        src={sampleImage}
        alt={sampleAlt}
        onZLoad={(e) => setLog(loadLog(e.detail.naturalWidth, e.detail.naturalHeight))}
        onZChange={(e) => setLog(changeLog(e.detail.value))}
      />
      <ZText variant="muted" size="sm">{log}</ZText>
    </ZStack>
  );
}

```

### Case: toolbar

#### React
```tsx
import { useRef, useState } from 'react';
import { ZButton, ZButtonGroup, ZCropper, ZStack, ZText } from '@zelviora/react';
import {
  emptyLog, exportLog, exportType, rotateStep, sampleAlt, sampleImage, toolbarButtons, toolbarLabel, toolbarLog, zoomStep,
  type CropArea,
} from '../data.ts';

/**
 * The `toolbar` slot replaces the default buttons: `zoomTo()` and `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.
 */
export function CropperToolbar() {
  const cropper = useRef<HTMLZCropperElement>(null);
  const [area, setArea] = useState<CropArea>();
  const [exported, setExported] = useState(emptyLog);
  const zoom = (step: number) => cropper.current?.zoomTo((area?.zoom ?? 1) + step);
  const rotate = () => cropper.current?.rotateTo((area?.rotate ?? 0) + rotateStep);
  const reset = async () => {
    await cropper.current?.reset();
    setArea(cropper.current?.value);
  };
  const exportArea = async () => {
    const blob = await cropper.current?.getCroppedBlob({ type: exportType }).catch(() => undefined);
    setExported(exportLog(blob));
  };
  return (
    <ZStack gap="sm" className="demo-narrow">
      <ZCropper
        ref={cropper}
        src={sampleImage}
        alt={sampleAlt}
        onZLoad={() => setArea(cropper.current?.value)}
        onZInput={(e) => setArea(e.detail.value)}
        onZChange={(e) => setArea(e.detail.value)}
      >
        <ZButtonGroup slot="toolbar" label={toolbarLabel}>
          <ZButton size="sm" variant="outline" tone="neutral" onClick={() => zoom(-zoomStep)}>{toolbarButtons.zoomOut}</ZButton>
          <ZButton size="sm" variant="outline" tone="neutral" onClick={() => zoom(zoomStep)}>{toolbarButtons.zoomIn}</ZButton>
          <ZButton size="sm" variant="outline" tone="neutral" onClick={rotate}>{toolbarButtons.rotate}</ZButton>
          <ZButton size="sm" variant="outline" tone="neutral" onClick={reset}>{toolbarButtons.reset}</ZButton>
          <ZButton size="sm" onClick={exportArea}>{toolbarButtons.export}</ZButton>
        </ZButtonGroup>
      </ZCropper>
      <ZText variant="muted" size="sm">{toolbarLog(area, exported)}</ZText>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZCustomChart } from '@zelviora/react-chart';
import { slaData, slaSeries } from '../data.ts';

export function CustomChartBasic() {
  return (
    <ZCustomChart
      heading="Quarterly SLA Target vs Actual Performance"
      description="Bespoke custom series comparing actual availability scores against target baselines."
      xKey="quarter" data={slaData} series={slaSeries}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/react';
import { ZCustomChart } from '@zelviora/react-chart';
import { slaData, slaSeries } from '../data.ts';

export function CustomChartControlled() {
  const [hidden, setHidden] = useState<string[]>([]);
  const [selected, setSelected] = useState<string>('Click any chart element to inspect');

  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <ZButton
          size="sm"
          variant="outline"
          onClick={() => setHidden([])}
        >
          Show All Series
        </ZButton>
        <ZBadge tone="primary" variant="soft">
          {selected}
        </ZBadge>
        <ZText variant="muted" size="sm">
          Hidden: {hidden.length ? hidden.join(', ') : 'none'}
        </ZText>
      </ZStack>
      <ZCustomChart
        heading="Quarterly SLA Target vs Actual Performance (Interactive)"
        description="Bespoke custom series comparing actual availability scores against target baselines."
        xKey="quarter" data={slaData} series={slaSeries}
        selectable
        hiddenSeries={hidden}
        onZSeriesToggle={(e) => setHidden(e.detail.hiddenSeries)}
        onZPointSelect={(e) =>
          setSelected(`Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`)
        }
      />
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZCustomChart } from '@zelviora/react-chart';
import { slaData, slaSeries } from '../data.ts';

export function CustomChartCustomization() {
  return (
    <ZCustomChart
      className="demo-chart-brand"
      description="Bespoke custom series comparing actual availability scores against target baselines."
      valueFormat={{ maximumFractionDigits: 1 }}
      xKey="quarter" data={slaData} series={slaSeries} dataZoom renderer="canvas"
    >
      <span slot="heading">Quarterly SLA Target vs Actual Performance — Custom Theme Tokens &amp; Canvas</span>
    </ZCustomChart>
  );
}

```

### Case: states

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZCustomChart } from '@zelviora/react-chart';
import { slaData, slaSeries } from '../data.ts';

export function CustomChartStates() {
  return (
    <ZStack gap="lg">
      <ZCustomChart
        heading="Loading State (aria-busy)"
        loading
        xKey="quarter" data={slaData} series={slaSeries}
      />
      <ZCustomChart
        heading="Empty State"
        data={[]}
        series={slaSeries}
      />
      <ZCustomChart
        heading="Expanded Accessible Data Table"
        description="Bespoke custom series comparing actual availability scores against target baselines."
        showDataTable
        xKey="quarter" data={slaData} series={slaSeries}
      />
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZCustomChart } from '@zelviora/react-chart';
import { slaData, slaSeries } from '../data.ts';

export function CustomChartVariants() {
  return (
    <ZStack gap="lg">
      <ZCustomChart
        heading="Zoomable Custom Series"
        description="Interactive dataZoom custom series vs point-tooltip inspection mode."
        xKey="quarter" data={slaData} series={slaSeries} dataZoom
      />
      <ZCustomChart
        heading="Point Tooltip Mode"
        description="Interactive dataZoom custom series vs point-tooltip inspection mode."
        xKey="quarter" data={slaData} series={slaSeries} tooltipMode="point"
      />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZConfigProvider, ZDataTable, ZStack } from '@zelviora/react';
import { basicColumns, makeOrders } from '../data.ts';

const rows = makeOrders(4);

export function DataTableAppearance() {
  return (
    <ZStack gap="lg">
      <ZDataTable label="Small, striped" size="sm" striped rowHeader="code" columns={basicColumns} rows={rows} />
      <ZDataTable label="Medium, bordered" bordered rowHeader="code" columns={basicColumns} rows={rows} />
      <ZDataTable label="Large, striped and bordered" size="lg" striped bordered rowHeader="code" columns={basicColumns} rows={rows} />
      <ZConfigProvider density="compact">
        <ZDataTable label="Compact density" rowHeader="code" columns={basicColumns} rows={rows} />
      </ZConfigProvider>
    </ZStack>
  );
}

```

### Case: basic

#### React
```tsx
import { ZDataTable } from '@zelviora/react';
import { basicColumns, makeOrders } from '../data.ts';

const rows = makeOrders(50);

/** Click a header or press Enter on it to sort; arrows, Home/End and PageUp/PageDown move the focused cell. */
export function DataTableBasic() {
  return <ZDataTable label="Orders" rowHeader="code" columns={basicColumns} rows={rows} pageSize={10} />;
}

```

### Case: clipboard-export

#### React
```tsx
import { useRef, useState } from 'react';
import { ZButton, ZDataTable, ZStack } from '@zelviora/react';
import { editableColumns, makeOrders, type Order } from '../data.ts';

/**
 * 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.
 */
export function DataTableClipboardExport() {
  const tableRef = useRef<HTMLZDataTableElement>(null);
  const [rows, setRows] = useState<Order[]>(() => makeOrders(10));
  const [selected, setSelected] = useState<string[]>(['o1', 'o2']);
  const [status, setStatus] = useState('Select rows to view sum/avg metrics in the status bar, or right-click a cell.');

  return (
    <ZStack gap="sm">
      <ZDataTable
        ref={tableRef}
        label="Orders with clipboard and CSV export"
        rowHeader="code"
        selectionMode="multiple"
        statusBar
        contextMenu
        searchable
        pageSize={0}
        columns={editableColumns}
        rows={rows}
        selectedKeys={selected}
        onZSelectionChange={(e) => setSelected(e.detail.value)}
        onZCopy={(e) => setStatus(`Copied ${e.detail.rowKeys.length} row(s) to clipboard.`)}
        onZPaste={(e) => setStatus(`Pasted clipboard data starting at ${e.detail.rowKey} (${e.detail.column}).`)}
        onZCellChange={(e) => {
          const { rowKey, column, value } = e.detail;
          setRows((list) => list.map((r) => (r.key === rowKey ? { ...r, [column]: value } : r)));
        }}
      >
        <ZButton slot="toolbar" size="sm" variant="outline" tone="neutral" onClick={() => void tableRef.current?.exportCsv({ fileName: 'orders.csv' })}>
          Export all CSV
        </ZButton>
        <ZButton
          slot="toolbar"
          size="sm"
          variant="outline"
          tone="neutral"
          disabled={!selected.length}
          onClick={() => void tableRef.current?.exportCsv({ fileName: 'selected-orders.csv', onlySelected: true })}
        >
          Export selected ({selected.length})
        </ZButton>
      </ZDataTable>
      <p role="status">{status}</p>
    </ZStack>
  );
}

```

### Case: column-management

#### React
```tsx
import { useRef, useState } from 'react';
import { ZButton, ZDataTable, ZStack } from '@zelviora/react';
import { makeOrders, managedColumns } from '../data.ts';

const rows = makeOrders(24);

/**
 * 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()`.
 */
export function DataTableColumnManagement() {
  const tableRef = useRef<HTMLZDataTableElement>(null);
  const [savedState, setSavedState] = useState<Record<string, unknown> | null>(null);
  const [message, setMessage] = useState('Drag a column header, open its menu, or filter by City / Status / Paid.');

  const saveLayout = async () => {
    const state = await tableRef.current?.getState();
    if (state) {
      setSavedState(state as unknown as Record<string, unknown>);
      setMessage('Saved column order, pins, widths, sort and filters.');
    }
  };

  const restoreLayout = async () => {
    if (!savedState) return;
    await tableRef.current?.setState(savedState);
    setMessage('Restored saved table state.');
  };

  const resetLayout = async () => {
    await tableRef.current?.setState({
      sort: [],
      filters: {},
      globalFilter: '',
      hiddenColumns: [],
      columnWidths: {},
      columnOrder: [],
      pinnedColumns: {},
      page: 1,
    });
    setMessage('Reset layout to defaults.');
  };

  return (
    <ZStack gap="sm">
      <ZStack orientation="horizontal" gap="sm" alignItems="center">
        <ZButton size="sm" variant="outline" tone="neutral" onClick={saveLayout}>Save state</ZButton>
        <ZButton size="sm" variant="outline" tone="neutral" disabled={!savedState} onClick={restoreLayout}>Restore state</ZButton>
        <ZButton size="sm" variant="outline" tone="neutral" onClick={resetLayout}>Reset</ZButton>
      </ZStack>
      <ZDataTable
        ref={tableRef}
        label="Managed order columns"
        rowHeader="code"
        reorderableColumns
        columnMenu
        columnToggle
        searchable
        pageSize={8}
        columns={managedColumns}
        rows={rows}
        onZColumnOrderChange={(e) => setMessage(`Column order: ${e.detail.columnOrder.join(' → ')}`)}
        onZColumnPinChange={(e) => setMessage(`Column ${e.detail.column} pin: ${e.detail.pinned ?? 'unpinned'}`)}
      />
      <p role="status">{message}</p>
    </ZStack>
  );
}

```

### Case: conditional

#### React
```tsx
import { ZDataTable } from '@zelviora/react';
import { basicColumns, makeOrders, type Order } from '../data.ts';

const rows = makeOrders(12);

export function DataTableConditional() {
  return (
    <ZDataTable className="demo-data-table-orders" label="Orders" rowHeader="code" columns={basicColumns} rows={rows}
      rowParts={(r: Order) => (r.status === 'Overdue' ? ['overdue'] : [])}
      cellParts={(r: Order, key: string) => (key === 'total' && r.total < 0 ? ['negative'] : [])} />
  );
}

```

### Case: controlled

#### React
```tsx
import { useEffect, useState } from 'react';
import { ZDataTable } from '@zelviora/react';
import { basicColumns, makeOrders, type Order } from '../data.ts';

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));
}

export function DataTableControlled() {
  const [sort, setSort] = useState<Sort>([]);
  const [search, setSearch] = useState('');
  const [page, setPage] = useState(1);
  const [data, setData] = useState<{ rows: Order[]; total: number }>({ rows: [], total: 0 });
  const [loading, setLoading] = useState(true);
  useEffect(() => {
    let live = true;
    setLoading(true);
    void query(sort, search, page, 10).then((d) => { if (live) { setData(d); setLoading(false); } });
    return () => { live = false; };
  }, [sort, search, page]);
  return (
    <ZDataTable label="Orders (server)" rowHeader="code" processing="manual" searchable pageSize={10} pageSizeOptions={[10]}
      columns={basicColumns} rows={data.rows} rowCount={data.total} loading={loading} sort={sort} page={page} globalFilter={search}
      onZSortChange={(e) => setSort(e.detail.sort)} onZSearch={(e) => setSearch(e.detail.query)} onZPageChange={(e) => setPage(e.detail.page)} />
  );
}

```

### Case: editable

#### React
```tsx
import { useState } from 'react';
import { ZDataTable, ZStack } from '@zelviora/react';
import { editableColumns, editError, makeOrders, type Order } from '../data.ts';

/**
 * 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.
 */
export function DataTableEditable() {
  const [rows, setRows] = useState<Order[]>(() => makeOrders(8));
  const [message, setMessage] = useState('Edit the customer, the status or the total.');
  return (
    <ZStack gap="sm">
      <ZDataTable label="Editable orders" rowHeader="code" pageSize={0} columns={editableColumns} rows={rows}
        onZBeforeCellChange={(e) => {
          const error = editError(e.detail.column, e.detail.value);
          if (error) { e.preventDefault(); setMessage(error); }
        }}
        onZCellChange={(e) => {
          const { rowKey, column, value } = e.detail;
          setRows((list) => list.map((r) => (r.key === rowKey ? { ...r, [column]: value } : r)));
          setMessage(`Saved ${column} of ${rowKey}.`);
        }} />
      <p role="status">{message}</p>
    </ZStack>
  );
}

```

### Case: editing-modes

#### React
```tsx
import { useRef, useState } from 'react';
import { ZButton, ZDataTable, ZStack } from '@zelviora/react';
import { advancedEditColumns, editError, makeOrders, type Order } from '../data.ts';

type EditMode = 'cell' | 'row' | 'popup';

/**
 * 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`).
 */
export function DataTableEditingModes() {
  const tableRef = useRef<HTMLZDataTableElement>(null);
  const [rows, setRows] = useState<Order[]>(() => makeOrders(6));
  const [mode, setMode] = useState<EditMode>('cell');
  const [message, setMessage] = useState('Double-click or type on a cell to edit; press Delete to clear.');

  return (
    <ZStack gap="sm">
      <ZStack orientation="horizontal" gap="sm" alignItems="center">
        <ZButton size="sm" variant={mode === 'cell' ? 'solid' : 'outline'} tone="neutral" onClick={() => setMode('cell')}>Cell mode</ZButton>
        <ZButton size="sm" variant={mode === 'row' ? 'solid' : 'outline'} tone="neutral" onClick={() => setMode('row')}>Full-row mode</ZButton>
        <ZButton size="sm" variant={mode === 'popup' ? 'solid' : 'outline'} tone="neutral" onClick={() => setMode('popup')}>Popup mode</ZButton>
        <ZButton size="sm" variant="outline" tone="neutral" onClick={() => void tableRef.current?.undo()}>Undo</ZButton>
        <ZButton size="sm" variant="outline" tone="neutral" onClick={() => void tableRef.current?.redo()}>Redo</ZButton>
      </ZStack>
      <ZDataTable
        ref={tableRef}
        label="Advanced editable orders"
        rowHeader="code"
        editMode={mode}
        editOnKeyPress
        cellFlash
        pageSize={0}
        columns={advancedEditColumns}
        rows={rows}
        onZBeforeCellChange={(e) => {
          const err = editError(e.detail.column, e.detail.value);
          if (err) {
            e.preventDefault();
            setMessage(err);
          }
        }}
        onZCellChange={(e) => {
          const { rowKey, column, value, updatedRow } = e.detail;
          setRows((list) =>
            list.map((r) => (r.key === rowKey ? ((updatedRow as Order | undefined) ?? { ...r, [column]: value }) : r)),
          );
          setMessage(`Committed ${e.detail.changes ? 'row changes' : column} on ${rowKey}.`);
        }}
      />
      <p role="status">{message}</p>
    </ZStack>
  );
}

```

### Case: editors

#### React
```tsx
import { useMemo, useState } from 'react';
import { ZDataTable, ZStack } from '@zelviora/react';
import { editorColumns, makeEditorRows, type EditorRow } from '../data-analytics.ts';

/**
 * One table, every cell editor: open a cell with Enter, F2 or a double click. Each column picks `editor` (text, email,
 * textarea, number, slider, rating, select, radio, combobox, multiselect, tags, date, time, color, checkbox, switch) and
 * tunes it with `editorOptions` / `editorProps`. Enter commits, Escape cancels; Shift+Enter adds a line in the textarea.
 */
export function DataTableEditors() {
  const initial = useMemo(() => makeEditorRows(), []);
  const [rows, setRows] = useState<EditorRow[]>(initial);
  const [message, setMessage] = useState('Double-click a cell to edit it with its own editor.');
  return (
    <ZStack gap="sm">
      <ZDataTable
        label="Cell editors"
        rowHeader="name"
        pageSize={0}
        columns={editorColumns}
        rows={rows}
        onZCellChange={(e) => {
          const { rowKey, column, value } = e.detail;
          setRows((list) => list.map((r) => (r.key === rowKey ? { ...r, [column]: value } : r)));
          setMessage(`Saved ${column} of ${rowKey}: ${JSON.stringify(value)}`);
        }}
      />
      <p role="status">{message}</p>
    </ZStack>
  );
}

```

### Case: error

#### React
```tsx
import { useState } from 'react';
import { ZAlert, ZButton, ZDataTable } from '@zelviora/react';
import { basicColumns, makeOrders } from '../data.ts';

export function DataTableError() {
  const [rows, setRows] = useState<ReturnType<typeof makeOrders>>([]);
  return (
    <ZDataTable label="Orders" rowHeader="code" columns={basicColumns} rows={rows}>
      <ZAlert slot="empty" tone="destructive" heading="Could not load the orders">
        The server did not answer. <ZButton size="sm" variant="outline" tone="neutral" onClick={() => setRows(makeOrders(5))}>Retry</ZButton>
      </ZAlert>
    </ZDataTable>
  );
}

```

### Case: expandable

#### React
```tsx
import { ZDataTable, ZTable } from '@zelviora/react';
import { basicColumns, makeOrders } from '../data.ts';

const rows = makeOrders(6);
const 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' } },
];

export function DataTableExpandable() {
  return (
    <ZDataTable label="Orders with lines" rowHeader="code" columns={basicColumns} rows={rows} expandedKeys={['o1']}>
      {rows.map((o) => (
        <ZTable key={o.key} slot={`expanded:${o.key}`} caption={`Lines of ${o.code}`} size="sm" columns={lineColumns} rows={o.lines} />
      ))}
    </ZDataTable>
  );
}

```

### Case: formula-columns

#### React
```tsx
import { useMemo, useRef, useState } from 'react';
import { ZButton, ZDataTable, ZSelect, ZStack } from '@zelviora/react';
import { invoiceColumns, makeInvoiceLines, type InvoiceLine } from '../data-analytics.ts';

const modes = [
  { value: 'error', label: 'Errors: show #DIV/0!' },
  { value: 'zero', label: 'Errors: show 0' },
];

/**
 * Formula columns on the same row and across columns (amount, net, tax, total, net per unit). Qty, price and discount are
 * editable; the app stores the typed value, the table recomputes the formulas. The line with qty 0 fails on purpose
 * (`formulaErrors` chooses `#DIV/0!` or 0).
 */
export function DataTableFormulaColumns() {
  const ref = useRef<HTMLZDataTableElement>(null);
  const initial = useMemo(() => makeInvoiceLines(), []);
  const [rows, setRows] = useState<InvoiceLine[]>(initial);
  const [errors, setErrors] = useState('error');
  const [message, setMessage] = useState('Edit Qty, Price or Discount; set a Qty to 0 to see the formula error.');

  const computed = async () => {
    const list = (await ref.current?.getComputedRows()) ?? [];
    const sum = list.reduce((s, r) => s + (Number((r as Record<string, unknown>).total) || 0), 0);
    setMessage(`getComputedRows(): ${list.length} rows, sum of Total ${sum.toFixed(2)}.`);
  };

  return (
    <ZStack gap="sm">
      <ZStack orientation="horizontal" gap="sm" alignItems="center">
        <ZSelect label="Formula errors" options={modes} value={errors} onZChange={(e) => setErrors(String(e.detail.value))} />
        <ZButton size="sm" variant="outline" tone="neutral" onClick={computed}>Computed rows</ZButton>
        <ZButton size="sm" variant="outline" tone="neutral" onClick={() => { setRows(initial); setMessage('Reset the invoice lines.'); }}>Reset</ZButton>
      </ZStack>
      <ZDataTable
        ref={ref}
        label="Invoice lines"
        rowHeader="item"
        pageSize={0}
        formulaErrors={errors as 'error' | 'zero'}
        columns={invoiceColumns}
        rows={rows}
        onZCellChange={(e) => {
          const { rowKey, column, value } = e.detail;
          setRows((list) => list.map((r) => (r.key === rowKey ? { ...r, [column]: value } : r)));
          setMessage(`Saved ${column} of ${rowKey}: ${String(value)}.`);
        }}
      />
      <p role="status">{message}</p>
    </ZStack>
  );
}

```

### Case: formula-quarterly

#### React
```tsx
import { useMemo, useState } from 'react';
import { ZDataTable, ZStack } from '@zelviora/react';
import { makeQuarterly, quarterlyColumns, type Quarterly } from '../data-analytics.ts';

/**
 * Quarters are typed; Year and Best quarter are horizontal formulas (`+`, `MAX`). "% of all" divides by `SUM({{rows.total}})`,
 * which ignores the search; "% of shown" divides by `SUM({{visible.total}})`, which follows it. Search a product to compare.
 */
export function DataTableFormulaQuarterly() {
  const [rows, setRows] = useState<Quarterly[]>(() => makeQuarterly());
  const [message, setMessage] = useState('Search a product: "% of shown" changes, "% of all" does not.');
  const table = useMemo(() => quarterlyColumns, []);
  return (
    <ZStack gap="sm">
      <ZDataTable
        label="Quarterly sales"
        rowHeader="product"
        pageSize={0}
        searchable
        columns={table}
        rows={rows}
        onZCellChange={(e) => {
          const { rowKey, column, value } = e.detail;
          setRows((list) => list.map((r) => (r.key === rowKey ? { ...r, [column]: value } : r)));
          setMessage(`Saved ${column} of ${rowKey}: ${String(value)}.`);
        }}
        onZSearch={(e) => setMessage(`Search "${e.detail.query}".`)}
      />
      <p role="status">{message}</p>
    </ZStack>
  );
}

```

### Case: formula-tree

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZDataTable, ZStack } from '@zelviora/react';
import { budgetColumns, makeBudget, type BudgetRow } from '../data-analytics.ts';

/** Returns a copy of the tree with one cell of one node replaced (the original is not mutated). */
function setCell(nodes: BudgetRow[], key: string, column: string, value: unknown): BudgetRow[] {
  return nodes.map((n) => {
    if (n.key === key) return { ...n, [column]: value };
    return n.children ? { ...n, children: setCell(n.children, key, column, value) } : n;
  });
}

/** Keys of every node that has children (the tree opens fully). */
function parentKeys(nodes: BudgetRow[]): string[] {
  return nodes.flatMap((n) => (n.children ? [n.key, ...parentKeys(n.children)] : []));
}

/**
 * Budget as tree data: leaves are typed ("Enter a number"), parents show `SUM({{children.x}})` (`formulaScope: 'parent'`), and
 * Variance and Used % are formulas on the same row. Edit a leaf and every ancestor recomputes.
 */
export function DataTableFormulaTree() {
  const [rows, setRows] = useState<BudgetRow[]>(() => makeBudget());
  const [message, setMessage] = useState('Edit the Allocated or Actual of a leaf; its parents recompute.');
  const [expanded, setExpanded] = useState<string[]>(() => parentKeys(makeBudget()));
  return (
    <ZStack gap="sm">
      <ZStack orientation="horizontal" gap="sm" alignItems="center">
        <ZButton size="sm" variant="outline" tone="neutral" onClick={() => { setRows(makeBudget()); setMessage('Reset the budget.'); }}>Reset</ZButton>
      </ZStack>
      <ZDataTable
        label="Budget 2026"
        rowHeader="item"
        pageSize={0}
        maxHeight="460px"
        expandedKeys={expanded}
        onZExpandedChange={(e) => setExpanded(e.detail.expandedKeys ?? [])}
        columns={budgetColumns}
        rows={rows}
        onZCellChange={(e) => {
          const { rowKey, column, value } = e.detail;
          setRows((tree) => setCell(tree, rowKey, column, value));
          setMessage(`Saved ${column} of ${rowKey}: ${String(value)}.`);
        }}
      />
      <p role="status">{message}</p>
    </ZStack>
  );
}

```

### Case: formula-workbench

#### React
```tsx
import { useRef, useState } from 'react';
import { ZButton, ZDataTable, ZSelect, ZStack, ZSwitch } from '@zelviora/react';
import {
  budgetColumns, invoiceColumns, makeBudget, makeInvoiceLines, makeQuarterly, quarterlyColumns,
} from '../data-analytics.ts';

type Node = { key: string; children?: Node[] } & Record<string, unknown>;
type DatasetId = 'invoice' | 'quarterly' | 'budget';

const datasets = [
  { value: 'invoice', label: 'Invoice lines' },
  { value: 'quarterly', label: 'Quarterly sales' },
  { value: 'budget', label: 'Budget tree' },
];
const columnsOf = { invoice: invoiceColumns, quarterly: quarterlyColumns, budget: budgetColumns };
const headerOf = { invoice: 'item', quarterly: 'product', budget: 'item' };
const makeAll = (): Record<DatasetId, Node[]> => ({
  invoice: makeInvoiceLines() as unknown as Node[],
  quarterly: makeQuarterly() as unknown as Node[],
  budget: makeBudget() as unknown as Node[],
});

/** Returns a copy of the (tree) rows with one cell replaced. */
function setCell(nodes: Node[], key: string, column: string, value: unknown): Node[] {
  return nodes.map((n) => {
    if (n.key === key) return { ...n, [column]: value };
    return n.children ? { ...n, children: setCell(n.children, key, column, value) } : n;
  });
}
function parentKeys(nodes: Node[]): string[] {
  return nodes.flatMap((n) => (n.children ? [n.key, ...parentKeys(n.children)] : []));
}

/**
 * One table, three datasets (invoice, quarterly, budget tree). `formulaEditor` adds "Edit formula..." to the column menus,
 * `formulaErrors` is switched at runtime, `zColumnFormulaChange` is logged and `getFormulas()` / `getComputedRows()` are shown.
 */
export function DataTableFormulaWorkbench() {
  const ref = useRef<HTMLZDataTableElement>(null);
  const [dataset, setDataset] = useState<DatasetId>('invoice');
  const [data, setData] = useState(makeAll);
  const [zero, setZero] = useState(false);
  const [expanded, setExpanded] = useState<string[]>(() => parentKeys(makeBudget() as unknown as Node[]));
  const [log, setLog] = useState('Open a column menu and choose "Edit formula...".');
  const [output, setOutput] = useState('');

  const showFormulas = async () => setOutput(JSON.stringify(await ref.current?.getFormulas(), null, 2));
  const showComputed = async () => {
    const list = (await ref.current?.getComputedRows()) ?? [];
    setOutput(JSON.stringify(list.slice(0, 3), null, 2));
  };

  return (
    <ZStack gap="sm">
      <ZStack orientation="horizontal" gap="sm" alignItems="center">
        <ZSelect label="Dataset" options={datasets} value={dataset} onZChange={(e) => { setDataset(e.detail.value as DatasetId); setOutput(''); }} />
        <ZSwitch checked={zero} onZChange={(e) => setZero(e.detail.checked)}>Show 0 for errors</ZSwitch>
        <ZButton size="sm" variant="outline" tone="neutral" onClick={showFormulas}>Show formulas</ZButton>
        <ZButton size="sm" variant="outline" tone="neutral" onClick={showComputed}>Show computed rows</ZButton>
        <ZButton size="sm" variant="outline" tone="neutral" onClick={() => { setData(makeAll()); setLog('Reset all datasets.'); }}>Reset data</ZButton>
      </ZStack>
      <ZDataTable
        key={dataset}
        ref={ref}
        label="Formula workbench"
        rowHeader={headerOf[dataset]}
        pageSize={0}
        maxHeight="460px"
        formulaEditor
        formulaErrors={zero ? 'zero' : 'error'}
        expandedKeys={dataset === 'budget' ? expanded : undefined}
        onZExpandedChange={(e) => setExpanded(e.detail.expandedKeys ?? [])}
        columns={columnsOf[dataset]}
        rows={data[dataset]}
        onZCellChange={(e) => {
          const { rowKey, column, value } = e.detail;
          setData((all) => ({ ...all, [dataset]: setCell(all[dataset], rowKey, column, value) }));
          setLog(`Saved ${column} of ${rowKey}: ${String(value)}.`);
        }}
        onZColumnFormulaChange={(e) => setLog(`zColumnFormulaChange: ${e.detail.column} = ${e.detail.formula ?? '(removed)'}.`)}
      />
      <p role="status">{log}</p>
      {output ? <pre>{output}</pre> : null}
    </ZStack>
  );
}

```

### Case: grouped

#### React
```tsx
import { ZDataTable } from '@zelviora/react';
import { groupedColumns, makeOrders } from '../data.ts';

const rows = makeOrders(8);

export function DataTableGrouped() {
  return <ZDataTable label="Orders" rowHeader="code" selectionMode="multiple" columns={groupedColumns} rows={rows} />;
}

```

### Case: grouping-dragging

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZDataTable, ZStack } from '@zelviora/react';
import { basicColumns, groupedRowColumns, makeOrders, type Order } from '../data.ts';

const groupedDataset = makeOrders(18);

/**
 * 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`.
 */
export function DataTableGroupingDragging() {
  const [groupKeys, setGroupKeys] = useState<string[]>(['city']);
  const [expanded, setExpanded] = useState<string[]>(['group:city=London']);
  const [queue, setQueue] = useState<Order[]>(() => makeOrders(5));
  const [dragMessage, setDragMessage] = useState('Drag a row handle or press Alt+ArrowUp / Alt+ArrowDown to reorder.');

  return (
    <ZStack gap="lg">
      <ZStack gap="sm">
        <ZStack orientation="horizontal" gap="sm" alignItems="center">
          <ZButton size="sm" variant={groupKeys.length === 1 ? 'solid' : 'outline'} tone="neutral" onClick={() => setGroupKeys(['city'])}>
            Group by City
          </ZButton>
          <ZButton size="sm" variant={groupKeys.length === 2 ? 'solid' : 'outline'} tone="neutral" onClick={() => setGroupKeys(['city', 'status'])}>
            Group by City & Status
          </ZButton>
          <ZButton size="sm" variant={groupKeys.length === 0 ? 'solid' : 'outline'} tone="neutral" onClick={() => setGroupKeys([])}>
            Ungrouped
          </ZButton>
        </ZStack>
        <ZDataTable
          label="Regional order aggregations"
          rowHeader="code"
          pageSize={0}
          maxHeight="300px"
          groupBy={groupKeys}
          expandedKeys={expanded}
          onZExpandedChange={(e) => setExpanded(e.detail.expandedKeys ?? [])}
          columns={groupedRowColumns}
          rows={groupedDataset}
        />
      </ZStack>
      <ZStack gap="sm">
        <ZDataTable
          label="Dispatch priority queue"
          rowHeader="code"
          rowDraggable
          pageSize={0}
          columns={basicColumns}
          rows={queue}
          onZRowOrderChange={(e) => {
            setQueue(e.detail.rows as Order[]);
            setDragMessage(`Moved ${e.detail.sourceKey} ${e.detail.position} ${e.detail.targetKey}.`);
          }}
        />
        <p role="status">{dragMessage}</p>
      </ZStack>
    </ZStack>
  );
}

```

### Case: i18n

#### React
```tsx
import { ZConfigProvider, ZDataTable } from '@zelviora/react';
import { columns, rows } from '../data-i18n.ts';

/** With locale `vi` the search ignores accents ("ha noi" finds "Hà Nội") and the built-in texts are Vietnamese. */
export function DataTableI18n() {
  return (
    <ZConfigProvider locale="vi">
      <ZDataTable label="Đơn hàng" rowHeader="code" selectionMode="multiple" searchable columns={columns} rows={rows} />
    </ZConfigProvider>
  );
}

```

### Case: lazy-datasource

#### React
```tsx
import { useMemo } from 'react';
import { withTableCells, ZBadge, ZDataTable, ZStack } from '@zelviora/react';
import { basicColumns, createOrderDatasource, datasourceColumns, makeOrders, statusTone, type Order } from '../data.ts';

const DataTableWithCells = withTableCells(ZDataTable);
const virtualSlotRows = makeOrders(500);

/**
 * Top: `withTableCells(ZDataTable)` listens to `zRenderedRowsChange` so custom `renderCell` 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.
 */
export function DataTableLazyDatasource() {
  const datasource = useMemo(() => createOrderDatasource(), []);

  return (
    <ZStack gap="lg">
      <DataTableWithCells
        label="Virtualized status badges (500 orders)"
        rowHeader="code"
        virtual="on"
        maxHeight="240px"
        pageSize={0}
        columns={datasourceColumns}
        rows={virtualSlotRows}
        renderCell={({ key, value }) =>
          key === 'status' ? <ZBadge tone={statusTone(value)}>{String(value)}</ZBadge> : null
        }
      />
      <ZDataTable
        label="Server block datasource with lazy detail (400 orders)"
        rowHeader="code"
        searchable
        maxHeight="260px"
        columns={basicColumns}
        datasource={datasource}
        rowExpandable={(row: Order) => Array.isArray(row.lines) && row.lines.length > 0}
        renderDetail={(row: Order) =>
          `${row.code} (${row.city}) — ${row.lines.map((l) => `${l.qty}× ${l.product}`).join(', ')}`
        }
      />
    </ZStack>
  );
}

```

### Case: multi-sort

#### React
```tsx
import { useState } from 'react';
import { ZDataTable, ZStack } from '@zelviora/react';
import { basicColumns, makeOrders } from '../data.ts';

const rows = makeOrders(30);
type Sort = Array<{ key: string; direction: 'ascending' | 'descending' }>;

export function DataTableMultiSort() {
  const [sort, setSort] = useState<Sort>([{ key: 'city', direction: 'ascending' }, { key: 'total', direction: 'descending' }]);
  return (
    <ZStack gap="sm">
      <ZDataTable label="Orders by city, then total" rowHeader="code" pageSize={10} columns={basicColumns} rows={rows} sort={sort} onZSortChange={(e) => setSort(e.detail.sort)} />
      <span>Sort: {sort.map((s) => `${s.key} ${s.direction}`).join(', ') || 'none'}</span>
    </ZStack>
  );
}

```

### Case: pinned-rows-spanning

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZDataTable, ZStack } from '@zelviora/react';
import { makeSpanningRows, makeSummaryRows, orderCellSpan, pinnedTopOrders, spanningColumns } from '../data.ts';

const rows = makeSpanningRows();
const bottomRows = makeSummaryRows(rows);

/**
 * 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.
 */
export function DataTablePinnedRowsSpanning() {
  const [failed, setFailed] = useState(false);

  return (
    <ZStack gap="sm">
      <ZStack orientation="horizontal" gap="sm" alignItems="center">
        <ZButton size="sm" variant="outline" tone="neutral" onClick={() => setFailed((v) => !v)}>
          {failed ? 'Restore rows' : 'Simulate error state'}
        </ZButton>
      </ZStack>
      <ZDataTable
        className="demo-data-table-orders"
        label="Shipping manifest with pinned summary rows"
        rowHeader="code"
        bordered
        maxHeight="340px"
        rowHeight={44}
        pageSize={0}
        error={failed}
        errorText="Unable to load shipping manifest from warehouse gateway."
        columns={spanningColumns}
        rows={failed ? [] : rows}
        pinnedTopRows={failed ? [] : pinnedTopOrders}
        pinnedBottomRows={failed ? [] : bottomRows}
        cellSpan={orderCellSpan}
      />
    </ZStack>
  );
}

```

### Case: pinned

#### React
```tsx
import { useState } from 'react';
import { ZDataTable, ZStack } from '@zelviora/react';
import { makeWideRows, wideColumns } from '../data.ts';

const rows = makeWideRows(30);

export function DataTablePinned() {
  const [last, setLast] = useState('');
  return (
    <ZStack gap="sm">
      <ZDataTable label="Order metrics" rowHeader="code" maxHeight="20rem" pageSize={0} columns={wideColumns} rows={rows}
        onZColumnWidthChange={(e) => setLast(`${e.detail.column}: ${e.detail.width} px`)} />
      <span>{last ? `Last resize: ${last}` : 'Resize a column to see its new width.'}</span>
    </ZStack>
  );
}

```

### Case: pivot-basic

#### React
```tsx
import { useMemo } from 'react';
import { ZDataTable } from '@zelviora/react';
import { makeSales, salesColumns } from '../data-analytics.ts';

/**
 * `pivotMode` turns the sales lines into a pivot: one row per region (`pivot.rows`), one generated column per year
 * (`pivot.columns`) and the summed revenue in every cell (`pivot.values`), plus a Total column and a grand-total row.
 */
export function DataTablePivotBasic() {
  const rows = useMemo(() => makeSales(96), []);
  return (
    <ZDataTable
      label="Revenue by region and year"
      rowHeader="region"
      pageSize={0}
      pivotMode
      pivot={{
        rows: ['region'],
        columns: ['year'],
        values: [{ key: 'revenue', aggFunc: 'sum', header: 'Revenue' }],
        totalColumn: true,
        totalRow: true,
      }}
      columns={salesColumns}
      rows={rows}
    />
  );
}

```

### Case: pivot-formula

#### React
```tsx
import { useMemo, useState } from 'react';
import { ZDataTable, ZStack, ZSwitch } from '@zelviora/react';
import { makeSales, salesFormulaColumns, weightedLineMargin } from '../data-analytics.ts';

/**
 * Pivot x formula: Profit and Margin % are formula columns of the source rows, and the pivot aggregates them (profit sum,
 * margin with the custom `weightedLineMargin`). Edit the Profit formula from a column menu (`formulaEditor`): the pivot recomputes.
 * Turning pivot mode off shows the source table with its formula columns.
 */
export function DataTablePivotFormula() {
  const rows = useMemo(() => makeSales(96), []);
  const [pivotMode, setPivotMode] = useState(true);
  const [log, setLog] = useState('Open the Profit column menu (Detail view) and edit its formula, or use the sidebar.');
  const pivot = useMemo(
    () => ({
      rows: ['region'],
      columns: ['year'],
      values: [
        { key: 'profit', aggFunc: 'sum' as const, header: 'Profit' },
        { key: 'margin', aggFunc: weightedLineMargin, header: 'Margin %' },
      ],
      splitValues: true,
      totalColumn: 'after' as const,
    }),
    [],
  );
  return (
    <ZStack gap="sm">
      <ZSwitch checked={pivotMode} onZChange={(e) => setPivotMode(e.detail.checked)}>Pivot mode</ZSwitch>
      <ZDataTable
        label="Profit and margin pivot"
        rowHeader="region"
        pageSize={0}
        maxHeight="460px"
        pivotSidebar
        rowGroupPanel
        formulaEditor
        pivotMode={pivotMode}
        pivot={pivot}
        columns={salesFormulaColumns}
        rows={rows}
        onZPivotChange={(e) => { setPivotMode(e.detail.pivotMode); setLog(`zPivotChange: pivotMode ${e.detail.pivotMode} (${e.detail.reason}).`); }}
        onZColumnFormulaChange={(e) => setLog(`zColumnFormulaChange: ${e.detail.column} = ${e.detail.formula ?? '(removed)'}.`)}
      />
      <p role="status">{log}</p>
    </ZStack>
  );
}

```

### Case: pivot-groups

#### React
```tsx
import { useMemo, useState } from 'react';
import { ZDataTable, ZSelect, ZStack, ZSwitch } from '@zelviora/react';
import { makeSales, salesColumns, weightedMargin } from '../data-analytics.ts';

const totalOptions = [
  { value: 'before', label: 'Total column: before' },
  { value: 'after', label: 'Total column: after' },
  { value: 'off', label: 'Total column: off' },
];
const sortOptions = [
  { value: 'ascending', label: 'Years: ascending' },
  { value: 'descending', label: 'Years: descending' },
];

/**
 * Two row dimensions (region, product) form an expandable group tree with subtotals; three measures are split under each year
 * (`splitValues`), the margin uses the custom `aggFunc` `weightedMargin`. The controls change `totalColumn`, `groupDefaultExpanded`
 * and `sortColumns`.
 */
export function DataTablePivotGroups() {
  const rows = useMemo(() => makeSales(96), []);
  const [total, setTotal] = useState('after');
  const [expandAll, setExpandAll] = useState(false);
  const [sort, setSort] = useState('ascending');
  const pivot = useMemo(
    () => ({
      rows: ['region', 'product'],
      columns: ['year'],
      values: [
        { key: 'revenue', aggFunc: 'sum' as const, header: 'Revenue' },
        { key: 'units', aggFunc: 'sum' as const, header: 'Units' },
        { key: 'revenue', aggFunc: weightedMargin, header: 'Margin %' },
      ],
      splitValues: true,
      totalColumn: total === 'off' ? false : (total as 'before' | 'after'),
      groupDefaultExpanded: expandAll ? -1 : 1,
      sortColumns: sort as 'ascending' | 'descending',
    }),
    [total, expandAll, sort],
  );
  return (
    <ZStack gap="sm">
      <ZStack orientation="horizontal" gap="sm" alignItems="center">
        <ZSelect label="Total column" options={totalOptions} value={total} onZChange={(e) => setTotal(String(e.detail.value))} />
        <ZSelect label="Sort columns" options={sortOptions} value={sort} onZChange={(e) => setSort(String(e.detail.value))} />
        <ZSwitch checked={expandAll} onZChange={(e) => setExpandAll(e.detail.checked)}>Expand all groups</ZSwitch>
      </ZStack>
      <ZDataTable
        label="Revenue, units and margin by region, product and year"
        rowHeader="region"
        pageSize={0}
        maxHeight="460px"
        pivotMode
        pivot={pivot}
        columns={salesColumns}
        rows={rows}
      />
    </ZStack>
  );
}

```

### Case: pivot-workbench

#### React
```tsx
import { useMemo, useRef, useState } from 'react';
import { ZButton, ZDataTable, ZStack } from '@zelviora/react';
import { makeSales, salesColumns, weightedMargin } from '../data-analytics.ts';

const byRegion = {
  rows: ['region'],
  columns: ['year'],
  values: [{ key: 'revenue', aggFunc: 'sum' as const, header: 'Revenue' }],
  totalColumn: true,
  totalRow: true,
};
const byProduct = {
  rows: ['product'],
  columns: ['channel'],
  values: [
    { key: 'revenue', aggFunc: 'sum' as const, header: 'Revenue' },
    { key: 'revenue', aggFunc: weightedMargin, header: 'Margin %' },
  ],
  splitValues: true,
  totalColumn: 'after' as const,
};

/**
 * All pivot features on one table: the pivot sidebar, row group bar and pivot panel, search, status bar and CSV export.
 * The preset buttons call `setPivotConfig()` (null returns to the detail rows); `zPivotChange` and `zRowGroupChange` are logged.
 */
export function DataTablePivotWorkbench() {
  const ref = useRef<HTMLZDataTableElement>(null);
  const rows = useMemo(() => makeSales(96), []);
  const [log, setLog] = useState('Use the Pivot button, the sidebar or a preset.');
  const [config, setConfig] = useState('');

  const apply = async (cfg: typeof byRegion | typeof byProduct | null) => {
    await ref.current?.setPivotConfig(cfg);
  };
  const show = async () => setConfig(JSON.stringify(await ref.current?.getPivotConfig(), null, 2) ?? 'null');

  return (
    <ZStack gap="sm">
      <ZStack orientation="horizontal" gap="sm" alignItems="center">
        <ZButton size="sm" variant="outline" tone="neutral" onClick={() => apply(byRegion)}>By region x year</ZButton>
        <ZButton size="sm" variant="outline" tone="neutral" onClick={() => apply(byProduct)}>Product x channel</ZButton>
        <ZButton size="sm" variant="outline" tone="neutral" onClick={() => apply(null)}>Detail</ZButton>
        <ZButton size="sm" variant="outline" tone="neutral" onClick={show}>Show config</ZButton>
        <ZButton size="sm" variant="outline" tone="neutral" onClick={() => ref.current?.exportCsv()}>Export CSV</ZButton>
      </ZStack>
      <ZDataTable
        ref={ref}
        label="Sales pivot workbench"
        rowHeader="region"
        pageSize={0}
        maxHeight="460px"
        searchable
        statusBar
        pivotSidebar
        rowGroupPanel
        pivotPanel
        pivotMode
        pivot={byRegion}
        columns={salesColumns}
        rows={rows}
        onZPivotChange={(e) => setLog(`zPivotChange: pivotMode ${e.detail.pivotMode}, ${e.detail.pivot ? `${e.detail.pivot.rows.length} row dimension(s), ${e.detail.pivot.values.length} value(s)` : 'no pivot'} (${e.detail.reason}).`)}
        onZRowGroupChange={(e) => setLog(`zRowGroupChange: groupBy [${e.detail.groupBy.join(', ')}] (${e.detail.reason}).`)}
      />
      <p role="status">{log}</p>
      {config ? <pre>{config}</pre> : null}
    </ZStack>
  );
}

```

### Case: rtl

#### React
```tsx
import { ZDataTable } from '@zelviora/react';
import { groupedColumns, makeOrders } from '../data.ts';

const rows = makeOrders(6);

export function DataTableRtl() {
  return (
    <div dir="rtl">
      <ZDataTable label="Orders" rowHeader="code" selectionMode="multiple" searchable columns={groupedColumns} rows={rows} />
    </div>
  );
}

```

### Case: selection

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZDataTable, ZStack } from '@zelviora/react';
import { basicColumns, makeOrders, type Order } from '../data.ts';

const rows = makeOrders(10);

/** Locked orders cannot be selected; Space toggles a row, Shift+Arrow extends, Ctrl/Cmd+A selects all. */
export function DataTableSelection() {
  const [selected, setSelected] = useState<string[]>([]);
  const [sent, setSent] = useState('');
  return (
    <ZStack gap="sm">
      <ZDataTable label="Orders to invoice" rowHeader="code" selectionMode="multiple" disabledKey="locked" columns={basicColumns} rows={rows}
        selectedKeys={selected} onZSelectionChange={(e) => setSelected(e.detail.value)} />
      <ZStack orientation="horizontal" gap="sm" alignItems="center">
        <ZButton disabled={!selected.length} onClick={() => setSent(rows.filter((r: Order) => selected.includes(r.key)).map((r) => r.code).join(', '))}>Invoice {selected.length} orders</ZButton>
        <span>{sent ? `Sent: ${sent}` : 'Locked orders (every ninth) cannot be selected.'}</span>
      </ZStack>
    </ZStack>
  );
}

```

### Case: states

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZDataTable, ZStack } from '@zelviora/react';
import { basicColumns, makeOrders } from '../data.ts';

const rows = makeOrders(5);

export function DataTableStates() {
  const [loading, setLoading] = useState(false);
  return (
    <ZStack gap="lg">
      <ZDataTable label="Loading without rows" loading rowHeader="code" columns={basicColumns} rows={[]} />
      <ZDataTable label="Empty" emptyText="No orders yet" rowHeader="code" columns={basicColumns} rows={[]} />
      <ZStack gap="sm" alignItems="start">
        <ZButton variant="outline" tone="neutral" onClick={() => setLoading((v) => !v)}>{loading ? 'Stop loading' : 'Reload'}</ZButton>
        <ZDataTable label="Reloading keeps the rows" loading={loading} rowHeader="code" columns={basicColumns} rows={rows} />
      </ZStack>
      <ZDataTable label="Sorted with a selection" selectionMode="multiple" selectedKeys={['o2', 'o4']} sort={[{ key: 'customer', direction: 'ascending' }]} rowHeader="code" columns={basicColumns} rows={rows} />
    </ZStack>
  );
}

```

### Case: toolbar

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZDataTable } from '@zelviora/react';
import { makeOrders, orderColumns } from '../data.ts';

const rows = makeOrders(60);
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. */
export function DataTableToolbar() {
  const [hidden, setHidden] = useState<string[]>(load);
  const save = (next: string[]) => { setHidden(next); try { localStorage.setItem(STORE, JSON.stringify(next)); } catch { /* private mode */ } };
  return (
    <ZDataTable label="Orders" rowHeader="code" searchable columnToggle columnMenu pageSize={10} columns={orderColumns} rows={rows}
      hiddenColumns={hidden} onZColumnVisibilityChange={(e) => save(e.detail.hiddenColumns)}>
      <ZButton slot="toolbar" size="sm" variant="outline" tone="neutral">Export</ZButton>
    </ZDataTable>
  );
}

```

### Case: transactions

#### React
```tsx
import { useRef, useState } from 'react';
import { ZButton, ZDataTable, ZStack } from '@zelviora/react';
import { makeOrders, transactionColumns, type Order } from '../data.ts';

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.
 */
export function DataTableTransactions() {
  const tableRef = useRef<HTMLZDataTableElement>(null);
  const [rows] = useState<Order[]>(() => makeOrders(8));
  const [status, setStatus] = useState('Click a cell or run a delta transaction.');

  const addOrder = async () => {
    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 res = await tableRef.current?.applyTransaction({ add: [created], addIndex: 0 });
    if (res) setStatus(`Added ${res.added.length} order (${created.code}) at index 0.`);
  };

  const bumpFirstTotal = async () => {
    const current = (tableRef.current?.rows as Order[] | undefined) ?? [];
    if (!current.length) return;
    const first = current[0]!;
    const res = await tableRef.current?.applyTransaction({ update: [{ ...first, total: first.total + 125 }] });
    if (res) setStatus(`Updated ${res.updated.length} order (${first.code}) with cell flash.`);
  };

  const removeLast = async () => {
    const current = (tableRef.current?.rows as Order[] | undefined) ?? [];
    if (!current.length) return;
    const last = current[current.length - 1]!;
    const res = await tableRef.current?.applyTransaction({ remove: [last.code] });
    if (res) setStatus(`Removed ${res.removed.length} order (${last.code}).`);
  };

  return (
    <ZStack gap="sm">
      <ZStack orientation="horizontal" gap="sm" alignItems="center">
        <ZButton size="sm" onClick={addOrder}>Add order</ZButton>
        <ZButton size="sm" variant="outline" tone="neutral" onClick={bumpFirstTotal}>Increase first (+$125)</ZButton>
        <ZButton size="sm" variant="outline" tone="destructive" onClick={removeLast}>Remove last</ZButton>
      </ZStack>
      <ZDataTable
        ref={tableRef}
        label="Live order stream"
        rowHeader="code"
        rowKey={(row) => String(row.code)}
        cellFlash
        pageSize={0}
        columns={transactionColumns}
        rows={rows}
        onZCellClick={(e) => setStatus(`Clicked ${e.detail.column} on ${e.detail.rowKey}: ${String(e.detail.value)}`)}
      />
      <p role="status">{status}</p>
    </ZStack>
  );
}

```

### Case: tree

#### React
```tsx
import { ZDataTable } from '@zelviora/react';
import { categories } from '../data.ts';

const columns = [
  { key: 'name', header: 'Category' },
  { key: 'items', header: 'Items', type: 'number' as const },
];

export function DataTableTree() {
  return <ZDataTable label="Catalog" rowHeader="name" selectionMode="multiple" expandedKeys={['c1']} columns={columns} rows={categories} />;
}

```

### Case: virtual

#### React
```tsx
import { ZDataTable } from '@zelviora/react';
import { basicColumns, makeOrders } from '../data.ts';

const rows = makeOrders(10_000);

export function DataTableVirtual() {
  return <ZDataTable label="All orders" rowHeader="code" selectionMode="multiple" virtual="on" maxHeight="24rem" pageSize={0} columns={basicColumns} rows={rows} />;
}

```

### Case: wide

#### React
```tsx
import { ZDataTable } from '@zelviora/react';
import { dailyColumns, makeDailyRows } from '../data.ts';

const rows = makeDailyRows(1000);

/** 201 columns × 1000 rows: only the cells in view render (rows and columns); End / Ctrl+End scroll to the cell. */
export function DataTableWide() {
  return <ZDataTable label="Daily sales" rowHeader="store" virtual="on" virtualColumns="on" maxHeight="24rem" pageSize={0} columns={dailyColumns} rows={rows} />;
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZDatePicker, ZStack } from '@zelviora/react';

/** The app owns `value`: buttons set it from code (no event), the log lists user changes and month changes. */
export function DatePickerControlled() {
  const [value, setValue] = useState<string | null>('2026-10-15');
  const [log, setLog] = useState<string[]>([]);
  const add = (line: string) => setLog((l) => [line, ...l].slice(0, 5));
  return (
    <ZStack className="demo-narrow">
      <ZDatePicker
        label="Deadline"
       
        today="2026-10-02"
        value={value}
        onZChange={(e) => { setValue(e.detail.value); add(`zChange ${e.detail.value}`); }}
        onZMonthChange={(e) => add(`zMonthChange ${e.detail.month}`)}
      />
      <ZStack orientation="horizontal" gap="sm" wrap>
        <ZButton variant="outline" tone="neutral" onClick={() => setValue('2026-12-31')}>Set Dec 31, 2026</ZButton>
        <ZButton variant="outline" tone="neutral" onClick={() => setValue(null)}>Clear</ZButton>
      </ZStack>
      <span>Value: {value ?? 'null'}</span>
      <output>{log.join(' · ')}</output>
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZDatePicker } from '@zelviora/react';

/** Component tokens and calendar parts (`::part(calendar-cell-selected)`): see the `demo-date-picker-brand` rule in README. */
export function DatePickerCustomization() {
  return <ZDatePicker className="demo-narrow demo-date-picker-brand" label="Appointment date" today="2026-10-02" defaultValue="2026-10-15" />;
}

```

### Case: date-time

#### React
```tsx
import { useState } from 'react';
import { ZDatePicker, ZStack } from '@zelviora/react';

/** Date and time: 15-minute steps, office hours only (08:00–17:00); confirm with OK. */
const officeHours = (time: string) => time < '08:00' || time > '17:00';

export function DatePickerDateTime() {
  const [value, setValue] = useState<string | null>(null);
  return (
    <ZStack className="demo-narrow">
      <ZDatePicker
        label="Appointment"
       
        today="2026-10-02"
        showTime
        minuteStep={15}
        isTimeUnavailable={officeHours}
        value={value}
        onZChange={(e) => setValue(e.detail.value)}
      />
      <span>Value: {value ?? 'null'}</span>
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { useState } from 'react';
import { ZDatePicker, ZStack } from '@zelviora/react';

/** Type the day, month and year, or open the calendar; "today" is fixed so the demo never changes. */
export function DatePickerDefault() {
  const [value, setValue] = useState<string | null>(null);
  return (
    <ZStack className="demo-narrow">
      <ZDatePicker
        label="Date of birth"
       
        today="2026-10-02"
        hint="Type month/day/year or press Alt+↓ to open the calendar"
        clearable
        value={value}
        onZChange={(e) => setValue(e.detail.value)}
      />
      <span>Value: {value ?? 'null'}</span>
    </ZStack>
  );
}

```

### Case: dialog

#### React
```tsx
import { ZDatePicker } from '@zelviora/react';

/** Modal dialog popup (default on touch screens with `popupMode="auto"`): focus stays inside, a Close button. */
export function DatePickerDialog() {
  return <ZDatePicker className="demo-narrow" label="Check-in date" today="2026-10-02" popupMode="dialog" />;
}

```

### Case: form

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZDatePicker, ZField, ZStack } from '@zelviora/react';

/** Native form: the value is submitted as YYYY-MM-DD (FormData), required inside a field, reset restores defaults. */
export function DatePickerForm() {
  const [sent, setSent] = useState('');
  return (
    <form
      className="demo-narrow"
      onSubmit={(e) => {
        e.preventDefault();
        setSent(JSON.stringify([...new FormData(e.currentTarget).entries()]));
      }}
    >
      <ZStack>
        <ZField label="Delivery date" hint="Monday to Friday" required>
          <ZDatePicker name="delivery" today="2026-10-02" min="2026-10-02" required />
        </ZField>
        <ZDatePicker name="birthday" label="Date of birth" today="2026-10-02" defaultValue="2026-10-15" />
        <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
          <ZButton type="submit">Submit</ZButton>
          <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
        </ZStack>
        {sent && <output>{sent}</output>}
      </ZStack>
    </form>
  );
}

```

### Case: i18n

#### React
```tsx
import { ZDatePicker, ZGrid } from '@zelviora/react';

/** Segment order, names and first day of the week follow the locale; Arabic (RTL) keeps Latin digits. */
export function DatePickerI18n() {
  return (
    <ZGrid columns="1 sm:2" gap="md">
      <ZDatePicker label="Tiếng Việt (dd/mm/yyyy, thứ Hai)" locale="vi" today="2026-10-02" defaultValue="2026-10-15" />
      <ZDatePicker label="English US (mm/dd/yyyy, Sunday)" locale="en-US" today="2026-10-02" defaultValue="2026-10-15" />
      <ZDatePicker label="日本語 (yyyy/mm/dd)" locale="ja" today="2026-10-02" defaultValue="2026-10-15" />
      <div dir="rtl" lang="ar-EG">
        <ZDatePicker label="العربية" locale="ar-EG" today="2026-10-02" defaultValue="2026-10-15" />
      </div>
    </ZGrid>
  );
}

```

### Case: month-year

#### React
```tsx
import { ZDatePicker, ZStack } from '@zelviora/react';

/** Month picker (`YYYY-MM`) and year picker (`YYYY`): the popup shows months or years. */
export function DatePickerMonthYear() {
  return (
    <ZStack className="demo-narrow">
      <ZDatePicker label="Reporting period" today="2026-10-02" granularity="month" defaultValue="2026-10" />
      <ZDatePicker label="Fiscal year" today="2026-10-02" granularity="year" defaultValue="2026" />
    </ZStack>
  );
}

```

### Case: states

#### React
```tsx
import { ZDatePicker, ZGrid } from '@zelviora/react';

/** Empty, filled, disabled, readonly, invalid and display statuses; a long label in a narrow column wraps. */
export function DatePickerStates() {
  return (
    <ZGrid columns="1 sm:2" gap="md">
      <ZDatePicker label="Empty" today="2026-10-02" />
      <ZDatePicker label="With value" today="2026-10-02" defaultValue="2026-10-15" />
      <ZDatePicker label="Disabled" today="2026-10-02" defaultValue="2026-10-15" disabled />
      <ZDatePicker label="Readonly" today="2026-10-02" defaultValue="2026-10-15" readonly />
      <ZDatePicker label="Invalid" today="2026-10-02" defaultValue="2026-10-15" invalid />
      <ZDatePicker label="Warning" today="2026-10-02" defaultValue="2026-10-15" status="warning" />
      <ZDatePicker label="Success" today="2026-10-02" defaultValue="2026-10-15" status="success" />
      <ZDatePicker
        className="demo-narrow"
        label="Expected date to complete the whole business registration file and submit it to the regulator"
       
        today="2026-10-02"
        defaultValue="2026-10-15"
      />
    </ZGrid>
  );
}

```

### Case: two-months

#### React
```tsx
import { ZDatePicker } from '@zelviora/react';

/** Two months side by side with ISO week numbers. */
export function DatePickerTwoMonths() {
  return <ZDatePicker className="demo-narrow" label="Departure date" today="2026-10-02" defaultValue="2026-10-15" numberOfMonths={2} weekNumbers />;
}

```

### Case: unavailable

#### React
```tsx
import { ZDatePicker } from '@zelviora/react';

/** 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. */
export function DatePickerUnavailable() {
  return (
    <ZDatePicker className="demo-narrow" label="Working day" today="2026-10-02" isDateUnavailable={isWeekend}>
      <span slot="footer">Monday – Friday only</span>
    </ZDatePicker>
  );
}

```

### Case: validation

#### React
```tsx
import { ZButton, ZDatePicker, ZStack } from '@zelviora/react';

/** Required, a range (min / max) and a date that does not exist (type 02/31/2026 then leave the field). */
export function DatePickerValidation() {
  return (
    <form className="demo-narrow" onSubmit={(e) => e.preventDefault()}>
      <ZStack>
        <ZDatePicker name="start" label="Start date" today="2026-10-02" required />
        <ZDatePicker name="trip" label="Departure (within 2026)" today="2026-10-02" min="2026-01-01" max="2026-12-31" defaultValue="2025-12-20" />
        <ZDatePicker name="any" label="Try 02/31/2026" today="2026-10-02" hint="A date that does not exist is a bad input" />
        <ZButton type="submit">Submit</ZButton>
      </ZStack>
    </form>
  );
}

```

### Case: variants

#### React
```tsx
import { ZDatePicker, ZGrid } from '@zelviora/react';

/** Outline and filled field in every size. */
export function DatePickerVariants() {
  return (
    <ZGrid columns="1 sm:3" gap="md">
      <ZDatePicker label="Small" size="sm" today="2026-10-02" defaultValue="2026-10-15" />
      <ZDatePicker label="Medium" size="md" today="2026-10-02" defaultValue="2026-10-15" />
      <ZDatePicker label="Large" size="lg" today="2026-10-02" defaultValue="2026-10-15" />
      <ZDatePicker label="Small filled" size="sm" variant="filled" today="2026-10-02" />
      <ZDatePicker label="Medium filled" size="md" variant="filled" today="2026-10-02" />
      <ZDatePicker label="Large filled" size="lg" variant="filled" today="2026-10-02" />
    </ZGrid>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZDateRangePicker, ZStack } from '@zelviora/react';

/** `[start, end]` as YYYY-MM-DD; an end is null while missing. */
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. */
export function DateRangePickerControlled() {
  const [value, setValue] = useState<DateRange>(['2026-10-05', '2026-10-09']);
  const [log, setLog] = useState<string[]>([]);
  const add = (line: string) => setLog((l) => [line, ...l].slice(0, 5));
  return (
    <ZStack>
      <ZDateRangePicker
        label="Reporting period"
       
        today="2026-10-02"
        value={value}
        onZChange={(e) => { setValue(e.detail.value); add(`zChange ${JSON.stringify(e.detail.value)}`); }}
        onZMonthChange={(e) => add(`zMonthChange ${e.detail.month}`)}
      />
      <ZStack orientation="horizontal" gap="sm" wrap>
        <ZButton variant="outline" tone="neutral" onClick={() => setValue(['2026-11-01', '2026-11-30'])}>Set November</ZButton>
        <ZButton variant="outline" tone="neutral" onClick={() => setValue([null, null])}>Clear</ZButton>
      </ZStack>
      <span>Value: {JSON.stringify(value)}</span>
      <output>{log.join(' · ')}</output>
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZDateRangePicker } from '@zelviora/react';

/** Component tokens and range parts (`::part(calendar-cell-in-range)`): see the `demo-date-range-picker-brand` rule in README. */
export function DateRangePickerCustomization() {
  return (
    <ZDateRangePicker className="demo-date-range-picker-brand" label="Time off" today="2026-10-02" start="2026-10-05" end="2026-10-09" />
  );
}

```

### Case: default

#### React
```tsx
import { useState } from 'react';
import { ZDateRangePicker, ZStack } from '@zelviora/react';

/** `[start, end]` as YYYY-MM-DD; an end is null while missing. */
type DateRange = [string | null, string | null];

/** Type both dates, or open the calendar and click a start and an end day; "today" is fixed so the demo never changes. */
export function DateRangePickerDefault() {
  const [value, setValue] = useState<DateRange>([null, null]);
  return (
    <ZStack>
      <ZDateRangePicker
        label="Time off"
       
        today="2026-10-02"
        hint="Type month/day/year or press Alt+↓ to open the calendar"
        clearable
        value={value}
        onZChange={(e) => setValue(e.detail.value)}
      />
      <span>Value: {JSON.stringify(value)}</span>
    </ZStack>
  );
}

```

### Case: form

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZDateRangePicker, ZField, ZStack } from '@zelviora/react';

/** Native form: two FormData entries with the same name (start, end); required inside a field; reset restores defaults. */
export function DateRangePickerForm() {
  const [sent, setSent] = useState('');
  return (
    <form
      onSubmit={(e) => {
        e.preventDefault();
        setSent(JSON.stringify([...new FormData(e.currentTarget).entries()]));
      }}
    >
      <ZStack>
        <ZField label="Stay dates" hint="Check-in – check-out" required>
          <ZDateRangePicker name="stay" today="2026-10-02" min="2026-10-02" required />
        </ZField>
        <ZDateRangePicker name="period" label="Billing period" today="2026-10-02" start="2026-10-01" end="2026-10-31" />
        <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
          <ZButton type="submit">Submit</ZButton>
          <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
        </ZStack>
        {sent && <output>{sent}</output>}
      </ZStack>
    </form>
  );
}

```

### Case: i18n

#### React
```tsx
import { ZDateRangePicker, ZGrid } from '@zelviora/react';

/** Segment order, names and first day of the week follow the locale; Arabic (RTL) mirrors the fields and the calendar. */
export function DateRangePickerI18n() {
  return (
    <ZGrid columns="1 md:2" gap="md">
      <ZDateRangePicker label="Tiếng Việt" locale="vi" today="2026-10-02" start="2026-10-05" end="2026-10-09" />
      <ZDateRangePicker label="English US" locale="en-US" today="2026-10-02" start="2026-10-05" end="2026-10-09" />
      <ZDateRangePicker label="日本語" locale="ja" today="2026-10-02" start="2026-10-05" end="2026-10-09" />
      <div dir="rtl" lang="ar-EG">
        <ZDateRangePicker label="العربية" locale="ar-EG" today="2026-10-02" start="2026-10-05" end="2026-10-09" />
      </div>
    </ZGrid>
  );
}

```

### Case: max-days

#### React
```tsx
import { ZDateRangePicker } from '@zelviora/react';

/** A stay of 2 to 30 days: after the first click, days that would make the range too short or too long are disabled. */
export function DateRangePickerMaxDays() {
  return (
    <ZDateRangePicker label="Room booking" today="2026-10-02" min="2026-10-02" minDays={2} maxDays={30} hint="Minimum 2 days, maximum 30 days" />
  );
}

```

### Case: one-month

#### React
```tsx
import { ZDateRangePicker } from '@zelviora/react';

/** One month at a time in a modal dialog, as on a narrow touch screen. */
export function DateRangePickerOneMonth() {
  return <ZDateRangePicker className="demo-narrow" label="Business trips" today="2026-10-02" numberOfMonths={1} popupMode="dialog" />;
}

```

### Case: presets

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZDateRangePicker, ZStack } from '@zelviora/react';

/** `[start, end]` as YYYY-MM-DD; an end is null while missing. */
type DateRange = [string | null, string | null];

/** Quick ranges in the presets slot set `value` (today is fixed at 2026-10-02). */
export function DateRangePickerPresets() {
  const [value, setValue] = useState<DateRange>([null, null]);
  return (
    <ZStack>
      <ZDateRangePicker label="Date range" today="2026-10-02" value={value} onZChange={(e) => setValue(e.detail.value)}>
        <ZStack slot="presets" gap="xs">
          <ZButton size="sm" variant="ghost" tone="neutral" onClick={() => setValue(['2026-09-26', '2026-10-02'])}>Last 7 days</ZButton>
          <ZButton size="sm" variant="ghost" tone="neutral" onClick={() => setValue(['2026-09-03', '2026-10-02'])}>Last 30 days</ZButton>
          <ZButton size="sm" variant="ghost" tone="neutral" onClick={() => setValue(['2026-10-01', '2026-10-31'])}>This month</ZButton>
          <ZButton size="sm" variant="ghost" tone="neutral" onClick={() => setValue(['2026-09-01', '2026-09-30'])}>Last month</ZButton>
        </ZStack>
      </ZDateRangePicker>
      <span>Value: {JSON.stringify(value)}</span>
    </ZStack>
  );
}

```

### Case: states

#### React
```tsx
import { ZDateRangePicker, ZGrid } from '@zelviora/react';

/** Empty, filled, disabled, readonly, invalid and display statuses; a long label in a narrow column wraps. */
export function DateRangePickerStates() {
  return (
    <ZGrid columns="1 sm:2" gap="md">
      <ZDateRangePicker label="Empty" today="2026-10-02" />
      <ZDateRangePicker label="With value" today="2026-10-02" start="2026-10-05" end="2026-10-09" />
      <ZDateRangePicker label="Disabled" today="2026-10-02" start="2026-10-05" end="2026-10-09" disabled />
      <ZDateRangePicker label="Readonly" today="2026-10-02" start="2026-10-05" end="2026-10-09" readonly />
      <ZDateRangePicker label="Invalid" today="2026-10-02" start="2026-10-05" end="2026-10-09" invalid />
      <ZDateRangePicker label="Warning" today="2026-10-02" start="2026-10-05" end="2026-10-09" status="warning" />
      <ZDateRangePicker label="Success" today="2026-10-02" start="2026-10-05" end="2026-10-09" status="success" />
      <ZDateRangePicker
        className="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"
      />
    </ZGrid>
  );
}

```

### Case: unavailable

#### React
```tsx
import { ZDateRangePicker, ZGrid } from '@zelviora/react';

/** Booked days (Oct 10–12, 2026) cannot be picked; the second picker allows a range across them. */
const BOOKED = new Set(['2026-10-10', '2026-10-11', '2026-10-12']);
const isBooked = (date: string) => BOOKED.has(date);

export function DateRangePickerUnavailable() {
  return (
    <ZGrid columns="1 md:2" gap="md">
      <ZDateRangePicker label="Room 101" today="2026-10-02" isDateUnavailable={isBooked}>
        <span slot="footer">Fully booked Oct 10–12</span>
      </ZDateRangePicker>
      <ZDateRangePicker label="Room 101 (allow booked days inside the range)" today="2026-10-02" isDateUnavailable={isBooked} allowUnavailableInRange />
    </ZGrid>
  );
}

```

### Case: validation

#### React
```tsx
import { ZButton, ZDateRangePicker, ZStack } from '@zelviora/react';

/** Required, a min/max range, and an end typed before the start (type 10/10/2026 – 05/10/2026). */
export function DateRangePickerValidation() {
  return (
    <form onSubmit={(e) => e.preventDefault()}>
      <ZStack>
        <ZDateRangePicker name="trip" label="Trip" today="2026-10-02" required />
        <ZDateRangePicker
          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"
        />
        <ZDateRangePicker name="any" label="Try an end date before the start date" today="2026-10-02" start="2026-10-10" end="2026-10-05" />
        <ZButton type="submit">Submit</ZButton>
      </ZStack>
    </form>
  );
}

```

### Case: variants

#### React
```tsx
import { ZDateRangePicker, ZGrid } from '@zelviora/react';

/** Outline and filled field in every size. */
export function DateRangePickerVariants() {
  return (
    <ZGrid columns="1 sm:2" gap="md">
      <ZDateRangePicker label="Small" size="sm" today="2026-10-02" start="2026-10-05" end="2026-10-09" />
      <ZDateRangePicker label="Small filled" size="sm" variant="filled" today="2026-10-02" />
      <ZDateRangePicker label="Medium" size="md" today="2026-10-02" start="2026-10-05" end="2026-10-09" />
      <ZDateRangePicker label="Medium filled" size="md" variant="filled" today="2026-10-02" />
      <ZDateRangePicker label="Large" size="lg" today="2026-10-02" start="2026-10-05" end="2026-10-09" />
      <ZDateRangePicker label="Large filled" size="lg" variant="filled" today="2026-10-02" />
    </ZGrid>
  );
}

```


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

#### React
```tsx
import { ZDescriptions, ZDescriptionsItem } from '@zelviora/react';

export function DescriptionsBasic() {
  return (
    <ZDescriptions heading="Customer">
      <ZDescriptionsItem label="Full name">Anna Lee</ZDescriptionsItem>
      <ZDescriptionsItem label="Email">a@example.com</ZDescriptionsItem>
      <ZDescriptionsItem label="Phone">0912 345 678</ZDescriptionsItem>
      <ZDescriptionsItem label="City">London</ZDescriptionsItem>
      <ZDescriptionsItem label="Plan">Business</ZDescriptionsItem>
      <ZDescriptionsItem label="Customer since">03/2021</ZDescriptionsItem>
    </ZDescriptions>
  );
}

```

### Case: composition

#### React
```tsx
import { ZBadge, ZButton, ZCard, ZDescriptions, ZDescriptionsItem, ZLink, ZTag } from '@zelviora/react';

export function DescriptionsComposition() {
  return (
    <ZCard>
      <ZDescriptions heading="Project" headingLevel={2}>
        <ZButton slot="actions" size="sm" variant="outline" tone="neutral">Edit</ZButton>
        <ZDescriptionsItem label="Status"><ZBadge tone="success">Active</ZBadge></ZDescriptionsItem>
        <ZDescriptionsItem label="Tags"><ZTag>design</ZTag> <ZTag>web</ZTag></ZDescriptionsItem>
        <ZDescriptionsItem label="Repository"><ZLink href="#repo">github.com/acme/site</ZLink></ZDescriptionsItem>
        <ZDescriptionsItem label="Owner">Mark Tran</ZDescriptionsItem>
      </ZDescriptions>
    </ZCard>
  );
}

```

### Case: data

#### React
```tsx
import { ZDescriptions } from '@zelviora/react';

const 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 },
];

export function DescriptionsData() {
  return <ZDescriptions heading="Invoice" items={items} bordered />;
}

```

### Case: responsive

#### React
```tsx
import { ZDescriptions, ZDescriptionsItem } from '@zelviora/react';

export function DescriptionsResponsive() {
  return (
    <ZDescriptions heading="Auto columns" className="demo-descriptions-columns">
      <ZDescriptionsItem label="CPU">8 vCPU</ZDescriptionsItem>
      <ZDescriptionsItem label="Memory">32 GB</ZDescriptionsItem>
      <ZDescriptionsItem label="Disk">500 GB SSD</ZDescriptionsItem>
      <ZDescriptionsItem label="Region">ap-southeast-1</ZDescriptionsItem>
      <ZDescriptionsItem label="Zone">a</ZDescriptionsItem>
      <ZDescriptionsItem label="Uptime">99.98%</ZDescriptionsItem>
      <ZDescriptionsItem label="Created">01/09/2026</ZDescriptionsItem>
      <ZDescriptionsItem label="Owner">ops</ZDescriptionsItem>
    </ZDescriptions>
  );
}

```

### Case: sizes

#### React
```tsx
import { ZDescriptions, ZDescriptionsItem, ZStack } from '@zelviora/react';

const sizes = ['sm', 'md', 'lg'] as const;

export function DescriptionsSizes() {
  return (
    <ZStack gap="lg">
      {sizes.map((size) => (
        <ZDescriptions key={size} heading={`Size ${size}`} size={size} bordered columns={2}>
          <ZDescriptionsItem label="Order">DH-0001</ZDescriptionsItem>
          <ZDescriptionsItem label="Total">$1,250.00</ZDescriptionsItem>
        </ZDescriptions>
      ))}
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZDescriptions, ZDescriptionsItem, ZStack } from '@zelviora/react';

export function DescriptionsVariants() {
  return (
    <ZStack gap="lg">
      <ZDescriptions heading="Vertical" layout="vertical" columns={3}>
        <ZDescriptionsItem label="Order">DH-0001</ZDescriptionsItem>
        <ZDescriptionsItem label="Status">Shipped</ZDescriptionsItem>
        <ZDescriptionsItem label="Total">$1,250.00</ZDescriptionsItem>
      </ZDescriptions>
      <ZDescriptions heading="Bordered" bordered columns={2}>
        <ZDescriptionsItem label="Order">DH-0001</ZDescriptionsItem>
        <ZDescriptionsItem label="Status">Shipped</ZDescriptionsItem>
        <ZDescriptionsItem label="Total">$1,250.00</ZDescriptionsItem>
        <ZDescriptionsItem label="Paid by">Card</ZDescriptionsItem>
        <ZDescriptionsItem label="Address" span="full">12 Baker Street, Marylebone, London</ZDescriptionsItem>
      </ZDescriptions>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZDialog, ZField, ZInput, ZStack, ZTag, ZText } from '@zelviora/react';

export function DialogControlled() {
  const [open, setOpen] = useState(false);
  const [log, setLog] = useState<string[]>([]);

  return (
    <ZStack gap="sm">
      <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
        <ZButton onClick={() => setOpen(true)}>Open from state</ZButton>
        <ZTag size="sm">open: {String(open)}</ZTag>
      </ZStack>
      <ZDialog
        heading="Rename project"
        open={open}
        showFooter
        confirmLabel="Save"
        onZOpenChange={(e) => {
          setOpen(e.detail.open);
          setLog((l) => [...l, `${e.detail.open ? 'opened' : 'closed'} (${e.detail.reason})`]);
        }}
      >
        <ZField label="New name">
          <ZInput name="name" autoFocus />
        </ZField>
      </ZDialog>
      {log.length > 0 ? (
        <ZStack gap="xs">
          {log.map((entry, i) => (
            <ZText key={i} size="sm" variant="muted">
              {entry}
            </ZText>
          ))}
        </ZStack>
      ) : null}
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { ZButton, ZDialog, ZText } from '@zelviora/react';

export function DialogDefault() {
  return (
    <ZDialog heading="Project details" description="Summary of the current project." showFooter hideCancel confirmLabel="Close">
      <ZButton slot="trigger">Open dialog</ZButton>
      <ZText as="p">The project was created on 2 October 2026 and has 12 members.</ZText>
    </ZDialog>
  );
}

```

### Case: non-modal

#### React
```tsx
import { ZButton, ZDialog, ZText } from '@zelviora/react';

export function DialogNonModal() {
  return (
    <ZDialog heading="Keyboard shortcuts" nonModal size="sm">
      <ZButton slot="trigger" variant="outline" tone="neutral">
        Show shortcuts
      </ZButton>
      <ZText as="p">The page stays interactive and scrollable while this dialog is open. Press Escape to close it.</ZText>
    </ZDialog>
  );
}

```


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

#### React
```tsx
import { ZDonutChart } from '@zelviora/react-chart';
import { costData, costSeries } from '../data.ts';

export function DonutChartBasic() {
  return (
    <ZDonutChart
      heading="Monthly Cloud Cost Allocation (USD)"
      description="Compute and Database clusters account for the majority of monthly cloud spend."
      xKey="service" data={costData} series={costSeries}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/react';
import { ZDonutChart } from '@zelviora/react-chart';
import { costData, costSeries } from '../data.ts';

export function DonutChartControlled() {
  const [hidden, setHidden] = useState<string[]>([]);
  const [selected, setSelected] = useState<string>('Click any chart element to inspect');

  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <ZButton
          size="sm"
          variant="outline"
          onClick={() => setHidden([])}
        >
          Show All Series
        </ZButton>
        <ZBadge tone="primary" variant="soft">
          {selected}
        </ZBadge>
        <ZText variant="muted" size="sm">
          Hidden: {hidden.length ? hidden.join(', ') : 'none'}
        </ZText>
      </ZStack>
      <ZDonutChart
        heading="Monthly Cloud Cost Allocation (USD) (Interactive)"
        description="Compute and Database clusters account for the majority of monthly cloud spend."
        xKey="service" data={costData} series={costSeries}
        selectable
        hiddenSeries={hidden}
        onZSeriesToggle={(e) => setHidden(e.detail.hiddenSeries)}
        onZPointSelect={(e) =>
          setSelected(`Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`)
        }
      />
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZDonutChart } from '@zelviora/react-chart';
import { costData, costSeries } from '../data.ts';

export function DonutChartCustomization() {
  return (
    <ZDonutChart
      className="demo-chart-brand"
      description="Compute and Database clusters account for the majority of monthly cloud spend."
      valueFormat={{ maximumFractionDigits: 1 }}
      xKey="service" data={costData} series={costSeries} innerRadius="55%" padAngle={4} startAngle={90} renderer="canvas"
    >
      <span slot="heading">Monthly Cloud Cost Allocation (USD) — Custom Theme Tokens &amp; Canvas</span>
    </ZDonutChart>
  );
}

```

### Case: states

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZDonutChart } from '@zelviora/react-chart';
import { costData, costSeries } from '../data.ts';

export function DonutChartStates() {
  return (
    <ZStack gap="lg">
      <ZDonutChart
        heading="Loading State (aria-busy)"
        loading
        xKey="service" data={costData} series={costSeries}
      />
      <ZDonutChart
        heading="Empty State"
        data={[]}
        series={costSeries}
      />
      <ZDonutChart
        heading="Expanded Accessible Data Table"
        description="Compute and Database clusters account for the majority of monthly cloud spend."
        showDataTable
        xKey="service" data={costData} series={costSeries}
      />
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZDonutChart } from '@zelviora/react-chart';
import { costData, costSeries } from '../data.ts';

export function DonutChartVariants() {
  return (
    <ZStack gap="lg">
      <ZDonutChart
        heading="Slim Padded Ring"
        description="Slim ring with angular padding vs thicker ring with external labels hidden."
        xKey="service" data={costData} series={costSeries} innerRadius="62%" outerRadius="78%" padAngle={3}
      />
      <ZDonutChart
        heading="Compact Thick Ring"
        description="Slim ring with angular padding vs thicker ring with external labels hidden."
        xKey="service" data={costData} series={costSeries} innerRadius="35%" outerRadius="72%" showLabel={false}
      />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZDrawer, ZStack } from '@zelviora/react';

/** `open` held in React state and updated from zOpenChange, which reports the reason. */
export function DrawerControlled() {
  const [open, setOpen] = useState(false);
  const [log, setLog] = useState<string[]>([]);
  return (
    <ZStack gap="sm">
      <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
        <ZButton onClick={() => setOpen(true)}>Open from state</ZButton>
        <span>open: {String(open)}</span>
      </ZStack>
      <ZDrawer
        heading="Filters"
        open={open}
        onZOpenChange={(e) => {
          setOpen(e.detail.open);
          setLog((l) => [...l, `${e.detail.open ? 'opened' : 'closed'} (${e.detail.reason})`]);
        }}
      >
        <p>Status, owner and date filters go here.</p>
        <ZButton slot="footer" variant="outline" tone="neutral" onClick={() => setOpen(false)}>Cancel</ZButton>
        <ZButton slot="footer" onClick={() => setOpen(false)}>Apply</ZButton>
      </ZDrawer>
      <ul>
        {log.map((l, i) => (
          <li key={i}>{l}</li>
        ))}
      </ul>
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { ZButton, ZDrawer } from '@zelviora/react';

/** A modal drawer from the end edge: page inert, focus returns to the trigger when it closes. */
export function DrawerDefault() {
  return (
    <ZDrawer heading="Order #1024" description="Placed on 2 October 2026.">
      <ZButton slot="trigger">Open drawer</ZButton>
      <p>3 items, delivery to London. Use Escape, the close button or the backdrop to close.</p>
      <ZButton slot="actions" variant="ghost" tone="neutral" size="sm">Print</ZButton>
      <ZButton slot="footer" variant="outline" tone="neutral" data-z-dialog-close>Close</ZButton>
      <ZButton slot="footer" data-z-dialog-close>Confirm</ZButton>
    </ZDrawer>
  );
}

```

### Case: form

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZDrawer, ZInput, ZStack } from '@zelviora/react';

/** An edit form in a drawer: Save submits the form; closing is blocked while the form has unsaved changes. */
export function DrawerForm() {
  const [open, setOpen] = useState(false);
  const [dirty, setDirty] = useState(false);
  const [saved, setSaved] = useState('Mark Tran');
  return (
    <ZStack gap="sm">
      <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
        <ZButton onClick={() => setOpen(true)}>Edit profile</ZButton>
        <span>Name: {saved}</span>
      </ZStack>
      <ZDrawer
        heading="Edit profile"
        description={dirty ? 'Unsaved changes: save or reset before closing.' : undefined}
        open={open}
        onZBeforeClose={(e) => { if (dirty) e.preventDefault(); }}
        onZOpenChange={(e) => setOpen(e.detail.open)}
      >
        <form
          id="drawer-profile"
          onReset={() => setDirty(false)}
          onSubmit={(e) => {
            e.preventDefault();
            setSaved(String(new FormData(e.currentTarget).get('name') ?? ''));
            setDirty(false);
            setOpen(false);
          }}
        >
          <ZInput name="name" label="Full name" required defaultValue={saved} onZInput={() => setDirty(true)} />
        </form>
        <ZButton slot="footer" type="reset" form="drawer-profile" variant="outline" tone="neutral">Reset</ZButton>
        <ZButton slot="footer" type="submit" form="drawer-profile">Save</ZButton>
      </ZDrawer>
    </ZStack>
  );
}

```

### Case: nested

#### React
```tsx
import { ZButton, ZDrawer } from '@zelviora/react';

/** A drawer opened inside another one: the parent moves aside (pushed); Escape closes the top one only. */
export function DrawerNested() {
  return (
    <ZDrawer heading="Order #1024" size="lg">
      <ZButton slot="trigger">Open order</ZButton>
      <p>Customer: Anna Lee.</p>
      <ZDrawer heading="Customer" size="sm">
        <ZButton slot="trigger" variant="outline" tone="neutral">Customer details</ZButton>
        <p>Phone, address and order history.</p>
        <ZButton slot="footer" data-z-dialog-close>Back to order</ZButton>
      </ZDrawer>
    </ZDrawer>
  );
}

```

### Case: placements

#### React
```tsx
import { ZButton, ZConfigProvider, ZDrawer, ZStack } from '@zelviora/react';

const placements = ['start', 'end', 'top', 'bottom'] as const;

/** The four logical edges; in RTL `start` is the right edge. */
export function DrawerPlacements() {
  return (
    <ZStack orientation="horizontal" wrap gap="sm">
      {placements.map((p) => (
        <ZDrawer key={p} heading={`Placement ${p}`} placement={p}>
          <ZButton slot="trigger" variant="outline" tone="neutral">{p}</ZButton>
          <p>This drawer slides in from the {p} edge.</p>
        </ZDrawer>
      ))}
      <ZConfigProvider dir="rtl" lang="ar">
        <ZDrawer heading="البداية" placement="start">
          <ZButton slot="trigger" variant="outline" tone="neutral">start (RTL)</ZButton>
          <p>في الاتجاه من اليمين إلى اليسار تكون البداية على اليمين.</p>
        </ZDrawer>
      </ZConfigProvider>
    </ZStack>
  );
}

```

### Case: sizes

#### React
```tsx
import { ZButton, ZDrawer, ZStack } from '@zelviora/react';

const sizes = ['sm', 'md', 'lg', 'xl', 'full'] as const;

/** Width steps (height for top/bottom); never wider than the viewport. Long content scrolls in the body. */
export function DrawerSizes() {
  return (
    <ZStack orientation="horizontal" wrap gap="sm">
      {sizes.map((s) => (
        <ZDrawer key={s} heading={`Size ${s}`} size={s}>
          <ZButton slot="trigger" variant="outline" tone="neutral">{s}</ZButton>
          {Array.from({ length: 30 }, (_, i) => (
            <p key={i}>Paragraph {i + 1}: the body scrolls while the header and footer stay.</p>
          ))}
          <ZButton slot="footer" data-z-dialog-close>Done</ZButton>
        </ZDrawer>
      ))}
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZDropdownMenu, ZMenuItem, ZStack } from '@zelviora/react';

/** Controlled `open` (+ `onZOpenChange`), a disabled menu and typeahead ("r" finds "Rename"). */
export function DropdownMenuControlled() {
  const [open, setOpen] = useState(false);
  return (
    <ZStack orientation="horizontal" wrap alignItems="center" gap="md">
      <ZDropdownMenu open={open} onZOpenChange={(e) => setOpen(e.detail.open)}>
        <ZButton slot="trigger" variant="outline" tone="neutral">File</ZButton>
        <ZMenuItem value="open">Open</ZMenuItem>
        <ZMenuItem value="rename">Rename</ZMenuItem>
        <ZMenuItem value="close">Close</ZMenuItem>
      </ZDropdownMenu>
      <ZButton variant="ghost" tone="neutral" onClick={() => setOpen(true)}>Open from code</ZButton>
      <ZDropdownMenu disabled>
        <ZButton slot="trigger" variant="outline" tone="neutral" disabled>Disabled</ZButton>
        <ZMenuItem>Never shown</ZMenuItem>
      </ZDropdownMenu>
      <span>{open ? 'Open' : 'Closed'}</span>
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZDropdownMenu, ZMenuItem, ZMenuSeparator, ZStack } from '@zelviora/react';

export function DropdownMenuDefault() {
  const [last, setLast] = useState('');
  return (
    <ZStack orientation="horizontal" wrap alignItems="center" gap="md">
      <ZDropdownMenu onZSelect={(e) => setLast(e.detail.value)}>
        <ZButton slot="trigger" variant="outline" tone="neutral">Actions</ZButton>
        <ZMenuItem value="edit">Edit<kbd slot="shortcut">⌘E</kbd></ZMenuItem>
        <ZMenuItem value="duplicate">Duplicate<kbd slot="shortcut">⌘D</kbd></ZMenuItem>
        <ZMenuItem value="archive" disabled>Archive</ZMenuItem>
        <ZMenuSeparator />
        <ZMenuItem value="delete" tone="destructive">Delete</ZMenuItem>
      </ZDropdownMenu>
      <span>{last ? `Last action: ${last}` : 'No action yet'}</span>
    </ZStack>
  );
}

```

### Case: i18n

#### React
```tsx
import { ZButton, ZDropdownMenu, ZMenuItem } from '@zelviora/react';

/** `lang="vi"`: typeahead on Vietnamese labels ("đ" finds "Đổi tên"). */
export function DropdownMenuI18n() {
  return (
    <ZDropdownMenu lang="vi">
      <ZButton slot="trigger" variant="outline" tone="neutral">Tệp</ZButton>
      <ZMenuItem value="open">Mở</ZMenuItem>
      <ZMenuItem value="rename">Đổi tên</ZMenuItem>
      <ZMenuItem value="close">Đóng</ZMenuItem>
    </ZDropdownMenu>
  );
}

```

### Case: variants

#### React
```tsx
import { useState } from 'react';
import {
  ZButton, ZDropdownMenu, ZMenuCheckboxItem, ZMenuGroup, ZMenuItem, ZMenuLabel, ZMenuRadioGroup, ZMenuRadioItem, ZMenuSeparator, ZMenuSub, ZStack,
} from '@zelviora/react';

export function DropdownMenuVariants() {
  const [grid, setGrid] = useState(true);
  const [ruler, setRuler] = useState(false);
  const [density, setDensity] = useState('comfortable');
  return (
    <ZStack orientation="horizontal" wrap alignItems="center" gap="md">
      <ZDropdownMenu>
        <ZButton slot="trigger" variant="outline" tone="neutral">View</ZButton>
        <ZMenuGroup>
          <ZMenuLabel>Show</ZMenuLabel>
          <ZMenuCheckboxItem checked={grid} keepOpenOnSelect onZChange={(e) => setGrid(e.detail.checked)}>Grid</ZMenuCheckboxItem>
          <ZMenuCheckboxItem checked={ruler} keepOpenOnSelect onZChange={(e) => setRuler(e.detail.checked)}>Ruler</ZMenuCheckboxItem>
        </ZMenuGroup>
        <ZMenuSeparator />
        <ZMenuRadioGroup value={density} onZChange={(e) => setDensity(e.detail.value)}>
          <ZMenuLabel>Density</ZMenuLabel>
          <ZMenuRadioItem value="comfortable">Comfortable</ZMenuRadioItem>
          <ZMenuRadioItem value="compact">Compact</ZMenuRadioItem>
        </ZMenuRadioGroup>
        <ZMenuSeparator />
        <ZMenuSub>
          <ZMenuItem slot="trigger">Share</ZMenuItem>
          <ZMenuItem value="mail">Email link</ZMenuItem>
          <ZMenuItem value="copy">Copy link</ZMenuItem>
          <ZMenuItem value="docs" href="#dropdown-menu" target="_blank">Open docs</ZMenuItem>
        </ZMenuSub>
      </ZDropdownMenu>
      <span>{`Grid ${grid ? 'on' : 'off'}, ruler ${ruler ? 'on' : 'off'}, ${density}`}</span>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZEcharts } from '@zelviora/react-chart';
import { universalData, universalSeries } from '../data.ts';

export function EchartsBasic() {
  return (
    <ZEcharts
      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={universalData} series={universalSeries}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/react';
import { ZEcharts } from '@zelviora/react-chart';
import { universalData, universalSeries } from '../data.ts';

export function EchartsControlled() {
  const [hidden, setHidden] = useState<string[]>([]);
  const [selected, setSelected] = useState<string>('Click any chart element to inspect');

  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <ZButton
          size="sm"
          variant="outline"
          onClick={() => setHidden([])}
        >
          Show All Series
        </ZButton>
        <ZBadge tone="primary" variant="soft">
          {selected}
        </ZBadge>
        <ZText variant="muted" size="sm">
          Hidden: {hidden.length ? hidden.join(', ') : 'none'}
        </ZText>
      </ZStack>
      <ZEcharts
        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={universalData} series={universalSeries}
        selectable
        hiddenSeries={hidden}
        onZSeriesToggle={(e) => setHidden(e.detail.hiddenSeries)}
        onZPointSelect={(e) =>
          setSelected(`Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`)
        }
      />
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZEcharts } from '@zelviora/react-chart';
import { universalData, universalSeries } from '../data.ts';

export function EchartsCustomization() {
  return (
    <ZEcharts
      className="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={universalData} series={universalSeries} dataZoom renderer="canvas"
    >
      <span slot="heading">Universal Declarative & Option-Driven Chart — Custom Theme Tokens &amp; Canvas</span>
    </ZEcharts>
  );
}

```

### Case: states

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZEcharts } from '@zelviora/react-chart';
import { universalData, universalSeries } from '../data.ts';

export function EchartsStates() {
  return (
    <ZStack gap="lg">
      <ZEcharts
        heading="Loading State (aria-busy)"
        loading
        type="bar" xKey="quarter" data={universalData} series={universalSeries}
      />
      <ZEcharts
        heading="Empty State"
        data={[]}
        series={universalSeries}
      />
      <ZEcharts
        heading="Expanded Accessible Data Table"
        description="Switch between any of the 25 chart types or pass a full ECharts option configuration."
        showDataTable
        type="bar" xKey="quarter" data={universalData} series={universalSeries}
      />
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZEcharts } from '@zelviora/react-chart';
import { universalData, universalSeries } from '../data.ts';

export function EchartsVariants() {
  return (
    <ZStack gap="lg">
      <ZEcharts
        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={universalData} series={universalSeries} smooth
      />
      <ZEcharts
        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={universalData} series={universalSeries} smooth dataZoom
      />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZEffectScatterChart } from '@zelviora/react-chart';
import { anomalyData, anomalySeries } from '../data.ts';

export function EffectScatterChartBasic() {
  return (
    <ZEffectScatterChart
      heading="Regional Anomaly Detection Spikes"
      description="Animated ripple markers highlight peak error rates across primary and failover zones."
      xKey="window" data={anomalyData} series={anomalySeries}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/react';
import { ZEffectScatterChart } from '@zelviora/react-chart';
import { anomalyData, anomalySeries } from '../data.ts';

export function EffectScatterChartControlled() {
  const [hidden, setHidden] = useState<string[]>([]);
  const [selected, setSelected] = useState<string>('Click any chart element to inspect');

  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <ZButton
          size="sm"
          variant="outline"
          onClick={() => setHidden([])}
        >
          Show All Series
        </ZButton>
        <ZBadge tone="primary" variant="soft">
          {selected}
        </ZBadge>
        <ZText variant="muted" size="sm">
          Hidden: {hidden.length ? hidden.join(', ') : 'none'}
        </ZText>
      </ZStack>
      <ZEffectScatterChart
        heading="Regional Anomaly Detection Spikes (Interactive)"
        description="Animated ripple markers highlight peak error rates across primary and failover zones."
        xKey="window" data={anomalyData} series={anomalySeries}
        selectable
        hiddenSeries={hidden}
        onZSeriesToggle={(e) => setHidden(e.detail.hiddenSeries)}
        onZPointSelect={(e) =>
          setSelected(`Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`)
        }
      />
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZEffectScatterChart } from '@zelviora/react-chart';
import { anomalyData, anomalySeries } from '../data.ts';

export function EffectScatterChartCustomization() {
  return (
    <ZEffectScatterChart
      className="demo-chart-brand"
      description="Animated ripple markers highlight peak error rates across primary and failover zones."
      valueFormat={{ maximumFractionDigits: 1 }}
      xKey="window" data={anomalyData} series={anomalySeries} rippleScale={3.5} tooltipMode="point" renderer="canvas"
    >
      <span slot="heading">Regional Anomaly Detection Spikes — Custom Theme Tokens &amp; Canvas</span>
    </ZEffectScatterChart>
  );
}

```

### Case: states

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZEffectScatterChart } from '@zelviora/react-chart';
import { anomalyData, anomalySeries } from '../data.ts';

export function EffectScatterChartStates() {
  return (
    <ZStack gap="lg">
      <ZEffectScatterChart
        heading="Loading State (aria-busy)"
        loading
        xKey="window" data={anomalyData} series={anomalySeries}
      />
      <ZEffectScatterChart
        heading="Empty State"
        data={[]}
        series={anomalySeries}
      />
      <ZEffectScatterChart
        heading="Expanded Accessible Data Table"
        description="Animated ripple markers highlight peak error rates across primary and failover zones."
        showDataTable
        xKey="window" data={anomalyData} series={anomalySeries}
      />
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZEffectScatterChart } from '@zelviora/react-chart';
import { anomalyData, anomalySeries } from '../data.ts';

export function EffectScatterChartVariants() {
  return (
    <ZStack gap="lg">
      <ZEffectScatterChart
        heading="Continuous Render Ripple"
        description="Continuous ripple animation on render vs hover-triggered emphasis ripple."
        xKey="window" data={anomalyData} series={anomalySeries} showEffectOn="render" rippleScale={4} symbolSize={16}
      />
      <ZEffectScatterChart
        heading="Emphasis Hover Ripple"
        description="Continuous ripple animation on render vs hover-triggered emphasis ripple."
        xKey="window" data={anomalyData} series={anomalySeries} showEffectOn="emphasis" rippleScale={2.5} symbolSize={12}
      />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZEmptyState } from '@zelviora/react';

export function EmptyStateBasic() {
  return <ZEmptyState />;
}

```

### Case: custom

#### React
```tsx
import { ZButton, ZEmptyState } from '@zelviora/react';

export function EmptyStateCustom() {
  return (
    <ZEmptyState headingLevel={3}>
      <svg slot="image" viewBox="0 0 48 48" width="64" height="64" fill="none" stroke="currentColor" strokeWidth="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.
      <ZButton slot="actions">Create order</ZButton>
      <ZButton slot="actions" variant="ghost" tone="neutral">Import from file</ZButton>
    </ZEmptyState>
  );
}

```

### Case: no-results

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZEmptyState, ZInput, ZStack } from '@zelviora/react';

export function EmptyStateNoResults() {
  const [query, setQuery] = useState('abc');
  return (
    <ZStack gap="md" className="demo-narrow">
      <ZInput type="search" label="Search orders" value={query} onZInput={(e) => setQuery(e.detail.value)} />
      <ZEmptyState heading={query ? `No results for "${query}"` : 'Type to search'} headingLevel={3}>
        Check the spelling or try another keyword.
        <ZButton slot="actions" variant="outline" tone="neutral" disabled={!query} onClick={() => setQuery('')}>
          Clear search
        </ZButton>
      </ZEmptyState>
    </ZStack>
  );
}

```

### Case: sizes

#### React
```tsx
import { ZCard, ZEmptyState, ZGrid } from '@zelviora/react';

const sizes = ['sm', 'md', 'lg'] as const;

export function EmptyStateSizes() {
  return (
    <ZGrid columns="1 md:3" gap="md">
      {sizes.map((size) => (
        <ZCard key={size}>
          <ZEmptyState size={size} heading={`Size ${size}`} description="No orders yet." />
        </ZCard>
      ))}
    </ZGrid>
  );
}

```


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

#### React
```tsx
import { ZField, ZInput } from '@zelviora/react';

export function FieldBasic() {
  return (
    <div className="demo-narrow">
      <ZField label="Email" hint="Use your work email" required>
        <ZInput name="email" type="email" required />
      </ZField>
    </div>
  );
}

```

### Case: error

#### React
```tsx
import { useState } from 'react';
import { ZField, ZInput } from '@zelviora/react';

const taken = ['admin', 'root'];

export function FieldError() {
  const [name, setName] = useState('admin');
  const error = taken.includes(name.trim().toLowerCase()) ? 'This username is already taken.' : null;
  return (
    <div className="demo-narrow">
      <ZField label="Username" hint="3 to 20 letters" error={error}>
        <ZInput name="username" value={name} onZInput={(e) => setName(e.detail.value)} />
      </ZField>
    </div>
  );
}

```

### Case: horizontal

#### React
```tsx
import { ZField, ZInput, ZTextarea, ZStack } from '@zelviora/react';

export function FieldHorizontal() {
  return (
    <ZStack>
      <ZField label="Full name" orientation="horizontal" required>
        <ZInput name="name" required />
      </ZField>
      <ZField label="Company" orientation="horizontal" showOptional>
        <ZInput name="company" />
      </ZField>
      <ZField label="About you" orientation="horizontal" hint="A few words for your profile">
        <ZTextarea name="about" rows={2} />
      </ZField>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZFileUpload, ZStack } from '@zelviora/react';

const MAX = 2 * 1024 * 1024;

/** Avatar: one image as a card; zBeforeAdd cancels images over 2 MB (the app shows its own message). */
export function FileUploadAvatar() {
  const [message, setMessage] = useState('');
  return (
    <ZStack gap="sm">
      <ZFileUpload
        label="Avatar"
        listType="card"
        maxCount={1}
        accept="image/*"
        onZBeforeAdd={(e) => {
          const big = e.detail.files.find((f) => f.size > MAX);
          setMessage(big ? `${big.name} is larger than 2 MB` : '');
          if (big) e.preventDefault();
        }}
      />
      {message && <span className="demo-text-destructive">{message}</span>}
    </ZStack>
  );
}

```

### Case: controlled

#### React
```tsx
import { useState, type ComponentProps } from 'react';
import { ZButton, ZFileUpload, ZStack } from '@zelviora/react';

type ZUploadFile = NonNullable<ComponentProps<typeof ZFileUpload>['files']>[number];

/** `files` held in React state and updated from zChange (reason add / remove / status); cleared from code. */
export function FileUploadControlled() {
  const [files, setFiles] = useState<ZUploadFile[]>([]);
  const [log, setLog] = useState<string[]>([]);
  return (
    <ZStack className="demo-narrow">
      <ZFileUpload
        label="Documents"
        multiple
        maxCount={3}
        files={files}
        onZChange={(e) => {
          setFiles(e.detail.files);
          setLog((l) => [...l, `${e.detail.reason}: ${e.detail.files.map((f) => f.name).join(', ') || '(empty)'}`]);
        }}
        onZError={(e) => {
          const err = e.detail.error;
          if (err.reason === 'reject') setLog((l) => [...l, `rejected: ${err.rejections.map((r) => `${r.name} (${r.errors.join(', ')})`).join(', ')}`]);
        }}
      />
      <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
        <ZButton variant="outline" tone="neutral" onClick={() => setFiles([])}>Clear from state</ZButton>
        <span>{files.length} file(s)</span>
      </ZStack>
      <ul>
        {log.map((l, i) => (
          <li key={i}>{l}</li>
        ))}
      </ul>
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { ZFileUpload, ZStack } from '@zelviora/react';

/** One file, chosen with the button (keyboard path) or dropped on the zone; sizes follow the locale. */
export function FileUploadDefault() {
  return (
    <ZStack className="demo-narrow">
      <ZFileUpload name="attachment" label="Attachment" accept=".pdf,image/*" maxSize={10 * 1024 * 1024} hint="Tab to the button, then Enter or Space opens the file picker." />
      <ZFileUpload name="contract" label="Contract" accept=".pdf" maxSize={5 * 1024 * 1024} multiple />
    </ZStack>
  );
}

```

### Case: finder

#### React
```tsx
import type { ComponentProps } from 'react';
import { ZFileUpload, ZGrid } from '@zelviora/react';

type ZFileUploadFinderConfig = NonNullable<ComponentProps<typeof ZFileUpload>['finderConfig']>;
type ZFinderItem = NonNullable<ComponentProps<typeof ZFileUpload>['finderItems']>[number];

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>`,
  )}`;

/**
 * Shared Finder repository containing mixed file types (images, PDFs, CSVs, ZIP archives)
 * across folders. Each `<ZFileUpload finder>` filters the visible items in Finder by its `accept` prop.
 */
const SHARED_FINDER_ITEMS: ZFinderItem[] = [
  { id: 'dir-brand', name: 'Brand Assets', type: 'folder', parentId: null, updatedAt: '2026-04-10' },
  { id: 'dir-docs', name: 'Project Docs', type: 'folder', parentId: null, updatedAt: '2026-04-11' },
  {
    id: 'img-hero',
    name: 'hero-banner.png',
    type: 'file',
    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',
    size: 312_800,
    mimeType: 'image/webp',
    dimensions: '1600 x 1200',
    parentId: null,
    updatedAt: '2026-04-14',
    thumbnail: svgThumb('#059669', '#0ea5e9', 'Product Cover'),
  },
  {
    id: 'img-logo',
    name: 'zelviora-mark.png',
    type: 'file',
    size: 158_200,
    mimeType: 'image/png',
    dimensions: '512 x 512',
    parentId: 'dir-brand',
    updatedAt: '2026-04-15',
    thumbnail: svgThumb('#db2777', '#f97316', 'Brand Mark'),
  },
  {
    id: 'doc-spec',
    name: 'architecture-spec.pdf',
    type: 'file',
    size: 1_245_000,
    mimeType: 'application/pdf',
    parentId: null,
    updatedAt: '2026-04-13',
  },
  {
    id: 'doc-budget',
    name: 'quarterly-report.csv',
    type: 'file',
    size: 84_300,
    mimeType: 'text/csv',
    parentId: null,
    updatedAt: '2026-04-15',
  },
  {
    id: 'doc-guide',
    name: 'onboarding-handbook.pdf',
    type: 'file',
    size: 920_000,
    mimeType: 'application/pdf',
    parentId: 'dir-docs',
    updatedAt: '2026-04-16',
  },
  {
    id: 'arc-release',
    name: 'release-bundle.zip',
    type: 'file',
    size: 3_480_000,
    mimeType: 'application/zip',
    parentId: null,
    updatedAt: '2026-04-16',
  },
];

const imageFinderConfig: ZFileUploadFinderConfig = {
  heading: 'Select images from Finder',
  items: SHARED_FINDER_ITEMS,
  viewMode: 'grid',
  maxFileSize: 10 * 1024 * 1024,
};

const documentFinderConfig: ZFileUploadFinderConfig = {
  heading: 'Select documents (.pdf, .csv) from Finder',
  items: SHARED_FINDER_ITEMS,
  viewMode: 'list',
  maxFileSize: 10 * 1024 * 1024,
};

/**
 * Choosing files with Finder (`finder` + `finderConfig`): Finder automatically filters its visible
 * files to match `accept` (e.g. `accept="image/*"` only displays images, hiding PDFs/CSVs/ZIPs in Finder).
 */
export function FileUploadFinder() {
  return (
    <ZGrid columns="1 md:2" gap="lg">
      <ZFileUpload
        finder
        finderConfig={imageFinderConfig}
        label="Product images (Finder — images only)"
        accept="image/*"
        listType="picture"
        multiple
        maxSize={10 * 1024 * 1024}
        hint="Opens Finder filtered by accept='image/*': only PNG/WebP images are shown even though Finder also contains PDF, CSV, and ZIP files."
      />
      <ZFileUpload
        finder
        finderConfig={documentFinderConfig}
        label="Attachments (Finder — PDF & CSV only)"
        accept=".pdf,.csv"
        multiple
        maxSize={10 * 1024 * 1024}
        hint="Opens Finder in list mode filtered by accept='.pdf,.csv': only PDF and CSV documents are visible."
      />
    </ZGrid>
  );
}

```

### Case: form

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZField, ZFileUpload, ZStack } from '@zelviora/react';

/** Native form without uploadRequest: each File is a FormData entry under the name; required in a field; reset. */
export function FileUploadForm() {
  const [sent, setSent] = useState('');
  return (
    <form
      className="demo-narrow"
      onSubmit={(e) => {
        e.preventDefault();
        const entries = [...new FormData(e.currentTarget).entries()].map(([k, v]) => [k, typeof v === 'string' ? v : `File(${v.name})`]);
        setSent(JSON.stringify(entries));
      }}
    >
      <ZStack>
        <ZField label="CV" hint="PDF, up to 2 MB" required>
          <ZFileUpload name="cv" accept=".pdf" maxSize={2 * 1024 * 1024} required />
        </ZField>
        <ZFileUpload name="certificates" label="Certificates" multiple />
        <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
          <ZButton type="submit">Submit</ZButton>
          <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
        </ZStack>
        {sent && <output>{sent}</output>}
      </ZStack>
    </form>
  );
}

```

### Case: i18n

#### React
```tsx
import { ZFileUpload, ZStack } from '@zelviora/react';

/** `lang="vi"`: built-in texts and sizes follow the Vietnamese locale. */
export function FileUploadI18n() {
  return (
    <ZStack className="demo-narrow">
      <ZFileUpload lang="vi" name="hop-dong" label="Hợp đồng" accept=".pdf" maxSize={5 * 1024 * 1024} multiple />
    </ZStack>
  );
}

```

### Case: states

#### React
```tsx
import type { ComponentProps } from 'react';
import { ZFileUpload, ZGrid } from '@zelviora/react';

type ZUploadFile = NonNullable<ComponentProps<typeof ZFileUpload>['files']>[number];

const uploading: ZUploadFile[] = [{ id: 'u1', name: 'video-gioi-thieu.mp4', size: 48_000_000, type: 'video/mp4', status: 'uploading', progress: 0.6 }];
const done: ZUploadFile[] = [{ id: 'd1', name: 'hop-dong.pdf', size: 1_258_291, type: 'application/pdf', status: 'done', progress: 1 }];
const failed: ZUploadFile[] = [{ id: 'e1', name: 'bang-luong.xlsx', size: 92_000, type: '', status: 'error', progress: 0, error: 'Server error' }];

/** Uploading, done, upload error, disabled, read-only, required/invalid and a size rejection (max 1 KB). */
export function FileUploadStates() {
  return (
    <ZGrid columns="1 md:2" gap="lg">
      <ZFileUpload label="Uploading" defaultFiles={uploading} />
      <ZFileUpload label="Done" defaultFiles={done} />
      <ZFileUpload label="Upload error" defaultFiles={failed} />
      <ZFileUpload label="Disabled" disabled defaultFiles={done} />
      <ZFileUpload label="Read-only" readonly defaultFiles={done} />
      <ZFileUpload label="Invalid" required invalid hint="Required: choose a file." />
      <ZFileUpload label="Max 1 KB" maxSize={1024} hint="Choose a larger file to see the rejection message." />
    </ZGrid>
  );
}

```

### Case: upload

#### React
```tsx
import { useRef, type ComponentProps } from 'react';
import { ZButton, ZFileUpload, ZStack } from '@zelviora/react';

type ZFileUploadRequest = NonNullable<ComponentProps<typeof ZFileUpload>['uploadRequest']>;

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. */
export function FileUploadUpload() {
  const manual = useRef<HTMLZFileUploadElement>(null);
  return (
    <ZStack className="demo-narrow" gap="lg">
      <ZFileUpload label="Upload function" multiple uploadRequest={fakeUpload} hint="Every third file fails: use the retry button." />
      <ZStack gap="sm">
        <ZFileUpload ref={manual} label="Manual upload" multiple manualUpload uploadRequest={fakeUpload} />
        <ZButton onClick={() => manual.current?.upload()}>Upload all</ZButton>
      </ZStack>
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import type { ComponentProps } from 'react';
import { ZFileUpload, ZGrid } from '@zelviora/react';

type ZUploadFile = NonNullable<ComponentProps<typeof ZFileUpload>['files']>[number];

// Files already on the server (no `file`): shown, not submitted again.
const 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 },
];

/** List types: rows, rows with thumbnails, a grid of cards; and a button without a drop zone. */
export function FileUploadVariants() {
  return (
    <ZGrid columns="1 md:2" gap="lg">
      <ZFileUpload label="Text (default)" multiple defaultFiles={existing} />
      <ZFileUpload label="Picture" listType="picture" accept="image/*" multiple defaultFiles={existing} />
      <ZFileUpload label="Card" listType="card" accept="image/*" multiple maxCount={4} defaultFiles={existing} />
      <ZFileUpload label="Button only" hideDropzone multiple defaultFiles={existing} />
    </ZGrid>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZFinder, ZStack, ZTag, ZText, type ZFinderItem } from '@zelviora/react';

const INITIAL_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',
  },
];

export function FinderBasic() {
  const [confirmed, setConfirmed] = useState<ZFinderItem[]>([]);

  return (
    <ZStack gap="md">
      <ZFinder
        className="demo-finder-frame"
        heading="Media Library"
        items={INITIAL_ITEMS}
        multiple
        onZSelect={(e) => setConfirmed(e.detail.items)}
      />
      {confirmed.length > 0 && (
        <ZStack orientation="horizontal" alignItems="center" gap="sm" wrap>
          <ZText size="sm" variant="muted">Confirmed:</ZText>
          {confirmed.map((item) => (
            <ZTag key={item.id}>{item.name}</ZTag>
          ))}
        </ZStack>
      )}
    </ZStack>
  );
}

```

### Case: config

#### React
```tsx
import { useMemo, useRef } from 'react';
import { ZFinder, ZStack, type ZFinderConfig, type ZFinderItem } from '@zelviora/react';

const SEED_STORAGE: 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',
  },
];

export function FinderConfig() {
  const storeRef = useRef<ZFinderItem[]>(structuredClone(SEED_STORAGE));

  const config = useMemo<ZFinderConfig>(
    () => ({
      defaultViewMode: 'list',
      maxFileSize: 5 * 1024 * 1024,
      allowedTypes: ['image/*', '.pdf', '.csv'],
      list: async (folderId) =>
        storeRef.current.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(),
        };
        storeRef.current = [...storeRef.current, 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(),
        };
        storeRef.current = [...storeRef.current, uploaded];
        return uploaded;
      },
      update: async (id, patch) => {
        let updatedEntry: ZFinderItem | undefined;
        storeRef.current = storeRef.current.map((entry) => {
          if (entry.id !== id) return entry;
          updatedEntry = { ...entry, ...patch, updatedAt: new Date().toISOString() };
          return updatedEntry;
        });
        return updatedEntry!;
      },
      delete: async (id) => {
        storeRef.current = storeRef.current.filter((entry) => entry.id !== id && entry.parentId !== id);
      },
    }),
    [],
  );

  return (
    <ZStack>
      <ZFinder className="demo-finder-frame" heading="Cloud Storage" config={config} multiple />
    </ZStack>
  );
}

```

### Case: dialog

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZFinder, ZStack, ZTag, ZText, dialogService, type ZFinderItem } from '@zelviora/react';

const PICKER_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',
  },
];

export function FinderDialog() {
  const [open, setOpen] = useState(false);
  const [picked, setPicked] = useState<ZFinderItem[]>([]);

  async function openViaService() {
    const ref = dialogService.openFinder({
      heading: 'Select Assets',
      multiple: true,
      items: PICKER_ITEMS,
    });
    const result = await ref.afterClosed;
    if (result) {
      setPicked(result.items);
    }
  }

  return (
    <ZStack gap="sm" alignItems="start">
      <ZStack orientation="horizontal" gap="xs" wrap="wrap">
        <ZButton variant="solid" onClick={openViaService}>
          Browse via DialogService
        </ZButton>
        <ZButton variant="outline" tone="neutral" onClick={() => setOpen(true)}>
          Browse Declarative Modal
        </ZButton>
      </ZStack>

      <ZFinder
        displayMode="dialog"
        heading="Select Assets"
        open={open}
        multiple
        items={PICKER_ITEMS}
        onZOpenChange={(e) => setOpen(e.detail.open)}
        onZSelect={(e) => setPicked(e.detail.items)}
      />

      {picked.length > 0 ? (
        <ZStack orientation="horizontal" alignItems="center" gap="xs" wrap="wrap">
          <ZText size="sm" variant="muted">Selected:</ZText>
          {picked.map((item) => (
            <ZTag key={item.id}>{item.name}</ZTag>
          ))}
        </ZStack>
      ) : (
        <ZText size="sm" variant="muted">No assets selected yet.</ZText>
      )}
    </ZStack>
  );
}

```

### Case: i18n

#### React
```tsx
import { ZFinder, ZStack, type ZFinderItem } from '@zelviora/react';

const DU_LIEU: 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',
  },
];

export function FinderI18n() {
  return (
    <ZStack>
      <ZFinder className="demo-finder-frame" lang="vi" items={DU_LIEU} multiple />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZFloatButton, ZIcon } from '@zelviora/react';

export function FloatButtonBasic() {
  return (
    <div className="demo-fixed-frame">
      <ZFloatButton label="New message"><ZIcon slot="icon" name="mail" /></ZFloatButton>
    </div>
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZFloatButton, ZFloatButtonGroup, ZIcon, ZStack, ZText } from '@zelviora/react';

export function FloatButtonControlled() {
  const [open, setOpen] = useState(false);
  const [reason, setReason] = useState('none');
  return (
    <ZStack gap="md" alignItems="start">
      <ZStack orientation="horizontal" gap="sm" alignItems="center">
        <ZButton variant="outline" tone="neutral" onClick={() => setOpen(!open)}>{open ? 'Close' : 'Open'} from code</ZButton>
        <ZText>Last reason: {reason}</ZText>
      </ZStack>
      <div className="demo-fixed-frame">
        <ZFloatButtonGroup label="Quick actions" open={open} onZOpenChange={(e) => { setOpen(e.detail.open); setReason(e.detail.reason); }}>
          <ZFloatButton label="Chat"><ZIcon slot="icon" name="chat" /></ZFloatButton>
          <ZFloatButton label="Help" variant="soft"><ZIcon slot="icon" name="help" /></ZFloatButton>
        </ZFloatButtonGroup>
      </div>
    </ZStack>
  );
}

```

### Case: group

#### React
```tsx
import { ZFloatButton, ZFloatButtonGroup, ZIcon } from '@zelviora/react';

export function FloatButtonGroup() {
  return (
    <div className="demo-fixed-frame">
      <ZFloatButtonGroup label="Quick actions">
        <ZFloatButton label="Chat"><ZIcon slot="icon" name="chat" /></ZFloatButton>
        <ZFloatButton label="Help" variant="soft"><ZIcon slot="icon" name="help" /></ZFloatButton>
      </ZFloatButtonGroup>
    </div>
  );
}

```

### Case: placement

#### React
```tsx
import { ZFloatButton, ZFloatButtonGroup, ZIcon } from '@zelviora/react';

export function FloatButtonPlacement() {
  return (
    <div className="demo-fixed-frame">
      <ZFloatButtonGroup label="Share" placement="start" trigger="hover">
        <ZFloatButton label="Copy link"><ZIcon slot="icon" name="content_copy" /></ZFloatButton>
        <ZFloatButton label="Email"><ZIcon slot="icon" name="mail" /></ZFloatButton>
      </ZFloatButtonGroup>
    </div>
  );
}

```

### Case: variants

#### React
```tsx
import { ZBadge, ZFloatButton, ZIcon } from '@zelviora/react';

export function FloatButtonVariants() {
  return (
    <div className="demo-fixed-frame">
      <ZFloatButton shape="square" label="Feedback" position="start"><ZIcon slot="icon" name="feedback" /></ZFloatButton>
      <ZFloatButton label="Notifications" variant="soft" tone="neutral"><ZIcon slot="icon" name="notifications" /><ZBadge slot="badge" tone="destructive">3</ZBadge></ZFloatButton>
    </div>
  );
}

```


================================================================================
# COMPONENT: FLOW
================================================================================

## Documentation

# Flow Angular Demos

Demo cases for `<z-flow>` in Angular.


## Examples & Implementation

### Case: basic

#### React
```tsx
import { useState } from 'react';
import { ZFlow, type FlowEdge, type FlowNode } from '@zelviora/react';

export function FlowBasic() {
  const [nodes] = useState<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: [],
    },
  ]);

  const [edges, setEdges] = useState<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',
    },
  ]);

  return (
    <div className="demo-flow-canvas">
      <ZFlow
        nodes={nodes}
        edges={edges}
        padding={40}
        onZConnect={(e) => {
          const { source, target, sourceHandle, targetHandle } = e.detail;
          const newEdge: FlowEdge = {
            id: `edge-${Date.now()}`,
            source,
            target,
            sourceHandle,
            targetHandle,
            type: 'smoothstep',
          };
          setEdges((prev) => [...prev, newEdge]);
        }}
      />
    </div>
  );
}

```

### Case: interactive

#### React
```tsx
import { useState } from 'react';
import { ZFlow, ZButton, ZStack, ZText, type FlowEdge, type FlowNode } from '@zelviora/react';

export function FlowInteractive() {
  const [zoom, setZoom] = useState(1);

  const [nodes] = useState<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: [],
    },
  ]);

  const [edges] = useState<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',
    },
  ]);

  return (
    <ZStack gap="sm">
      <ZStack orientation="horizontal" gap="xs" alignItems="center">
        <ZText variant="muted" size="sm">Zoom:</ZText>
        <ZButton size="sm" onClick={() => setZoom((z) => Math.max(0.5, Number((z - 0.1).toFixed(1))))}>-</ZButton>
        <span className="demo-flow-zoom-label">{Math.round(zoom * 100)}%</span>
        <ZButton size="sm" onClick={() => setZoom((z) => Math.min(2, Number((z + 0.1).toFixed(1))))}>+</ZButton>
        <ZButton size="sm" variant="outline" onClick={() => setZoom(1)}>Reset</ZButton>
      </ZStack>

      <div className="demo-flow-canvas-interactive">
        <ZFlow
          nodes={nodes}
          edges={edges}
          zoom={zoom}
          padding={50}
        />
      </div>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZField, ZForm, ZInput, ZTextarea, ZStack } from '@zelviora/react';

export function FormBasic() {
  const [sent, setSent] = useState('');
  return (
    <ZForm summary preventSubmit onZSubmit={(e) => setSent(JSON.stringify(e.detail.values))}>
      <form className="demo-narrow">
        <ZStack>
        <ZField label="Full name" required>
          <ZInput name="name" required />
        </ZField>
        <ZField label="Email" required>
          <ZInput name="email" type="email" required />
        </ZField>
        <ZField label="Message" hint="At least 10 characters">
          <ZTextarea name="message" minLength={10} />
        </ZField>
        <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
          <ZButton type="submit">Send</ZButton>
          <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
        </ZStack>
        {sent && <output>{sent}</output>}
        </ZStack>
      </form>
    </ZForm>
  );
}

```

### Case: cross-field

#### React
```tsx
import { ZButton, ZField, ZForm, ZInput, ZStack } from '@zelviora/react';

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. */
function 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.' : '');
}

export function FormCrossField() {
  return (
    <ZForm summary preventSubmit>
      <form className="demo-narrow">
        <ZStack>
        <ZField label="Password" required>
          <ZInput name="password" required minLength={8} onZChange={check} />
        </ZField>
        <ZField label="Confirm password" required>
          <ZInput name="confirm" required onZInput={check} />
        </ZField>
        <ZButton type="submit">Create account</ZButton>
        </ZStack>
      </form>
    </ZForm>
  );
}

```


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

#### React
```tsx
import { ZFunnelChart } from '@zelviora/react-chart';
import { funnelData, funnelSeries } from '../data.ts';

export function FunnelChartBasic() {
  return (
    <ZFunnelChart
      heading="Enterprise Trial Conversion Funnel"
      description="Stage-by-stage progression from landing page visits to signed enterprise contracts."
      xKey="stage" data={funnelData} series={funnelSeries}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/react';
import { ZFunnelChart } from '@zelviora/react-chart';
import { funnelData, funnelSeries } from '../data.ts';

export function FunnelChartControlled() {
  const [hidden, setHidden] = useState<string[]>([]);
  const [selected, setSelected] = useState<string>('Click any chart element to inspect');

  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <ZButton
          size="sm"
          variant="outline"
          onClick={() => setHidden([])}
        >
          Show All Series
        </ZButton>
        <ZBadge tone="primary" variant="soft">
          {selected}
        </ZBadge>
        <ZText variant="muted" size="sm">
          Hidden: {hidden.length ? hidden.join(', ') : 'none'}
        </ZText>
      </ZStack>
      <ZFunnelChart
        heading="Enterprise Trial Conversion Funnel (Interactive)"
        description="Stage-by-stage progression from landing page visits to signed enterprise contracts."
        xKey="stage" data={funnelData} series={funnelSeries}
        selectable
        hiddenSeries={hidden}
        onZSeriesToggle={(e) => setHidden(e.detail.hiddenSeries)}
        onZPointSelect={(e) =>
          setSelected(`Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`)
        }
      />
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZFunnelChart } from '@zelviora/react-chart';
import { funnelData, funnelSeries } from '../data.ts';

export function FunnelChartCustomization() {
  return (
    <ZFunnelChart
      className="demo-chart-brand"
      description="Stage-by-stage progression from landing page visits to signed enterprise contracts."
      valueFormat={{ maximumFractionDigits: 1 }}
      xKey="stage" data={funnelData} series={funnelSeries} funnelGap={4} renderer="canvas"
    >
      <span slot="heading">Enterprise Trial Conversion Funnel — Custom Theme Tokens &amp; Canvas</span>
    </ZFunnelChart>
  );
}

```

### Case: states

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZFunnelChart } from '@zelviora/react-chart';
import { funnelData, funnelSeries } from '../data.ts';

export function FunnelChartStates() {
  return (
    <ZStack gap="lg">
      <ZFunnelChart
        heading="Loading State (aria-busy)"
        loading
        xKey="stage" data={funnelData} series={funnelSeries}
      />
      <ZFunnelChart
        heading="Empty State"
        data={[]}
        series={funnelSeries}
      />
      <ZFunnelChart
        heading="Expanded Accessible Data Table"
        description="Stage-by-stage progression from landing page visits to signed enterprise contracts."
        showDataTable
        xKey="stage" data={funnelData} series={funnelSeries}
      />
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZFunnelChart } from '@zelviora/react-chart';
import { funnelData, funnelSeries } from '../data.ts';

export function FunnelChartVariants() {
  return (
    <ZStack gap="lg">
      <ZFunnelChart
        heading="Ascending Pyramid"
        description="Ascending pyramid ordering vs left-aligned conversion funnel."
        xKey="stage" data={funnelData} series={funnelSeries} funnelSort="ascending" funnelGap={6}
      />
      <ZFunnelChart
        heading="Left-Aligned Funnel"
        description="Ascending pyramid ordering vs left-aligned conversion funnel."
        xKey="stage" data={funnelData} series={funnelSeries} funnelAlign="left" funnelGap={2}
      />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZCard, ZGallery, ZGalleryItem } from '@zelviora/react';

/** 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. */
export function GalleryComposition() {
  return (
    <ZCard heading="Attachments" description="3 images" className="demo-narrow">
      <ZGallery label="Attachments" columns={3}>
        <ZGalleryItem src={pic('#bfdbfe', 'IMG_01')} alt="Screenshot of the error"></ZGalleryItem>
        <ZGalleryItem src={pic('#bbf7d0', 'IMG_02')} alt="Invoice"></ZGalleryItem>
        <ZGalleryItem src={pic('#fde68a', 'IMG_03')} alt="Delivery receipt"></ZGalleryItem>
      </ZGallery>
    </ZCard>
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZGallery, ZGalleryItem, ZStack } from '@zelviora/react';

/** 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 PHOTOS = ['#bfdbfe', '#fecaca', '#bbf7d0', '#fde68a'].map((c, i) => ({ src: pic(c, `Photo ${i + 1}`), alt: `Photo ${i + 1}` }));

/** The app owns `open` and `index`: the button opens the third image from code (no event); the log lists user changes. */
export function GalleryControlled() {
  const [open, setOpen] = useState(false);
  const [index, setIndex] = useState(0);
  const [log, setLog] = useState<string[]>([]);
  const add = (line: string) => setLog((l) => [line, ...l].slice(0, 5));
  return (
    <ZStack>
      <ZGallery
        label="Controlled"
        open={open}
        index={index}
        onZOpenChange={(e) => { setOpen(e.detail.open); add(`zOpenChange ${e.detail.open} (${e.detail.reason})`); }}
        onZChange={(e) => { setIndex(e.detail.index); add(`zChange ${e.detail.index} (${e.detail.reason})`); }}
      >
        {PHOTOS.map((p) => <ZGalleryItem key={p.alt} src={p.src} alt={p.alt}></ZGalleryItem>)}
      </ZGallery>
      <ZStack orientation="horizontal" gap="sm" wrap>
        <ZButton variant="outline" tone="neutral" onClick={() => { setIndex(2); setOpen(true); }}>Open image 3</ZButton>
      </ZStack>
      <span>open: {String(open)} · index: {index}</span>
      <output>{log.join(' · ')}</output>
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZGallery, ZGalleryItem } from '@zelviora/react';

/** 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 PHOTOS = ['#bfdbfe', '#fecaca', '#bbf7d0', '#fde68a', '#ddd6fe', '#fbcfe8'].map((c, i) => ({ src: pic(c, `${i + 1}`), alt: `Photo ${i + 1}` }));

/** `columns="3"`, gallery tokens (gap, radius) and the lightbox counter part: see `demo-gallery-brand` in README. */
export function GalleryCustomization() {
  return (
    <ZGallery className="demo-gallery-brand" label="Customization" columns={3}>
      {PHOTOS.map((p) => <ZGalleryItem key={p.alt} src={p.src} alt={p.alt}></ZGalleryItem>)}
    </ZGallery>
  );
}

```

### Case: data

#### React
```tsx
import { ZGallery } from '@zelviora/react';

/** 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'];
const 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,
}));

/** 300 images through `items` + `lazy`: only thumbnails near the viewport are created. */
export function GalleryData() {
  return (
    <div className="demo-gallery-scroll">
      <ZGallery label="Album of 300 photos" items={ITEMS} lazy></ZGallery>
    </div>
  );
}

```

### Case: default

#### React
```tsx
import { ZGallery, ZGalleryItem } from '@zelviora/react';

/** 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'];
const PHOTOS = COLORS.map((c, i) => ({ src: pic(c, `Photo ${i + 1}`), alt: `Product photo ${i + 1}` }));

/** Eight thumbnails: each is a button (one Tab stop); Enter opens the lightbox, ←/→ change the image, Escape closes. */
export function GalleryDefault() {
  return (
    <ZGallery label="Product photos">
      {PHOTOS.map((p) => <ZGalleryItem key={p.alt} src={p.src} alt={p.alt}></ZGalleryItem>)}
    </ZGallery>
  );
}

```

### Case: empty

#### React
```tsx
import { ZGallery } from '@zelviora/react';

/** No image: the gallery shows its empty text and `show()` does nothing. */
export function GalleryEmpty() {
  return <ZGallery label="Empty album"></ZGallery>;
}

```

### Case: i18n

#### React
```tsx
import { ZGallery, ZGalleryItem, ZStack } from '@zelviora/react';

/** 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 PHOTOS = ['#bfdbfe', '#fecaca', '#bbf7d0'].map((c, i) => ({ src: pic(c, `${i + 1}`), alt: `Ảnh ${i + 1}` }));

/** Counter and buttons follow the locale ("Ảnh 2 trên 3"); in RTL ←/→ are swapped. */
export function GalleryI18n() {
  return (
    <ZStack gap="lg">
      <div lang="vi">
        <ZGallery label="Tiếng Việt">
          {PHOTOS.map((p) => <ZGalleryItem key={p.alt} src={p.src} alt={p.alt}></ZGalleryItem>)}
        </ZGallery>
      </div>
      <div dir="rtl" lang="ar">
        <ZGallery label="RTL">
          {PHOTOS.map((p) => <ZGalleryItem key={p.alt} src={p.src} alt={p.alt}></ZGalleryItem>)}
        </ZGallery>
      </div>
    </ZStack>
  );
}

```

### Case: states

#### React
```tsx
import { ZGallery, ZGalleryItem } from '@zelviora/react';

/** 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>`)}`;

/** Image data that does not decode (a broken image without a network request). */
const BROKEN = 'data:image/png;base64,AAAA';

/** Captions, a loop through the images, and a broken image (the thumbnail and the lightbox keep the alt text). */
export function GalleryStates() {
  return (
    <ZGallery label="Album" loop>
      <ZGalleryItem src={pic('#bfdbfe', 'Front')} alt="Front" caption="Front"></ZGalleryItem>
      <ZGalleryItem src={pic('#fecaca', 'Back')} alt="Back" caption="Back"></ZGalleryItem>
      <ZGalleryItem src={BROKEN} alt="Broken image" caption="Image failed to load"></ZGalleryItem>
    </ZGallery>
  );
}

```


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

#### React
```tsx
import { ZGaugeChart } from '@zelviora/react-chart';
import { gaugeValue, gaugeData, gaugeSeries } from '../data.ts';

export function GaugeChartBasic() {
  return (
    <ZGaugeChart
      heading="Cluster CPU Utilization"
      description="Real-time compute utilization across production worker nodes."
      value={gaugeValue} min={0} max={100} unit="%" data={gaugeData} series={gaugeSeries}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/react';
import { ZGaugeChart } from '@zelviora/react-chart';
import { gaugeValue, gaugeData, gaugeSeries } from '../data.ts';

export function GaugeChartControlled() {
  const [hidden, setHidden] = useState<string[]>([]);
  const [selected, setSelected] = useState<string>('Click any chart element to inspect');

  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <ZButton
          size="sm"
          variant="outline"
          onClick={() => setHidden([])}
        >
          Show All Series
        </ZButton>
        <ZBadge tone="primary" variant="soft">
          {selected}
        </ZBadge>
        <ZText variant="muted" size="sm">
          Hidden: {hidden.length ? hidden.join(', ') : 'none'}
        </ZText>
      </ZStack>
      <ZGaugeChart
        heading="Cluster CPU Utilization (Interactive)"
        description="Real-time compute utilization across production worker nodes."
        value={gaugeValue} min={0} max={100} unit="%" data={gaugeData} series={gaugeSeries}
        selectable
        hiddenSeries={hidden}
        onZSeriesToggle={(e) => setHidden(e.detail.hiddenSeries)}
        onZPointSelect={(e) =>
          setSelected(`Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`)
        }
      />
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZGaugeChart } from '@zelviora/react-chart';
import { gaugeValue, gaugeData, gaugeSeries } from '../data.ts';

export function GaugeChartCustomization() {
  return (
    <ZGaugeChart
      className="demo-chart-brand"
      description="Real-time compute utilization across production worker nodes."
      valueFormat={{ maximumFractionDigits: 1 }}
      value={gaugeValue} min={0} max={100} unit="%" splitNumber={4} renderer="canvas" data={gaugeData} series={gaugeSeries}
    >
      <span slot="heading">Cluster CPU Utilization — Custom Theme Tokens &amp; Canvas</span>
    </ZGaugeChart>
  );
}

```

### Case: states

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZGaugeChart } from '@zelviora/react-chart';
import { gaugeValue, gaugeData, gaugeSeries } from '../data.ts';

export function GaugeChartStates() {
  return (
    <ZStack gap="lg">
      <ZGaugeChart
        heading="Loading State (aria-busy)"
        loading
        value={gaugeValue} min={0} max={100} unit="%" data={gaugeData} series={gaugeSeries}
      />
      <ZGaugeChart
        heading="Empty State"
        data={[]}
        series={gaugeSeries}
      />
      <ZGaugeChart
        heading="Expanded Accessible Data Table"
        description="Real-time compute utilization across production worker nodes."
        showDataTable
        value={gaugeValue} min={0} max={100} unit="%" data={gaugeData} series={gaugeSeries}
      />
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZGaugeChart } from '@zelviora/react-chart';
import { gaugeValue, gaugeData, gaugeSeries } from '../data.ts';

export function GaugeChartVariants() {
  return (
    <ZStack gap="lg">
      <ZGaugeChart
        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={gaugeData} series={gaugeSeries}
      />
      <ZGaugeChart
        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={gaugeData} series={gaugeSeries}
      />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZGraphChart } from '@zelviora/react-chart';
import { graphCategories, graphNodes, graphLinks, graphSeries } from '../data.ts';

export function GraphChartBasic() {
  return (
    <ZGraphChart
      heading="Microservice Dependency Network"
      description="Directed call graph connecting ingress gateways, domain services, and storage engines."
      nodes={graphNodes} links={graphLinks} categories={graphCategories} series={graphSeries}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/react';
import { ZGraphChart } from '@zelviora/react-chart';
import { graphCategories, graphNodes, graphLinks, graphSeries } from '../data.ts';

export function GraphChartControlled() {
  const [hidden, setHidden] = useState<string[]>([]);
  const [selected, setSelected] = useState<string>('Click any chart element to inspect');

  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <ZButton
          size="sm"
          variant="outline"
          onClick={() => setHidden([])}
        >
          Show All Series
        </ZButton>
        <ZBadge tone="primary" variant="soft">
          {selected}
        </ZBadge>
        <ZText variant="muted" size="sm">
          Hidden: {hidden.length ? hidden.join(', ') : 'none'}
        </ZText>
      </ZStack>
      <ZGraphChart
        heading="Microservice Dependency Network (Interactive)"
        description="Directed call graph connecting ingress gateways, domain services, and storage engines."
        nodes={graphNodes} links={graphLinks} categories={graphCategories} series={graphSeries}
        selectable
        hiddenSeries={hidden}
        onZSeriesToggle={(e) => setHidden(e.detail.hiddenSeries)}
        onZPointSelect={(e) =>
          setSelected(`Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`)
        }
      />
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZGraphChart } from '@zelviora/react-chart';
import { graphCategories, graphNodes, graphLinks, graphSeries } from '../data.ts';

export function GraphChartCustomization() {
  return (
    <ZGraphChart
      className="demo-chart-brand"
      description="Directed call graph connecting ingress gateways, domain services, and storage engines."
      valueFormat={{ maximumFractionDigits: 1 }}
      nodes={graphNodes} links={graphLinks} categories={graphCategories} series={graphSeries} roam curveness={0.2} renderer="canvas"
    >
      <span slot="heading">Microservice Dependency Network — Custom Theme Tokens &amp; Canvas</span>
    </ZGraphChart>
  );
}

```

### Case: states

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZGraphChart } from '@zelviora/react-chart';
import { graphCategories, graphNodes, graphLinks, graphSeries } from '../data.ts';

export function GraphChartStates() {
  return (
    <ZStack gap="lg">
      <ZGraphChart
        heading="Loading State (aria-busy)"
        loading
        nodes={graphNodes} links={graphLinks} categories={graphCategories} series={graphSeries}
      />
      <ZGraphChart
        heading="Empty State"
        nodes={[]} links={[]}
        series={graphSeries}
      />
      <ZGraphChart
        heading="Expanded Accessible Data Table"
        description="Directed call graph connecting ingress gateways, domain services, and storage engines."
        showDataTable
        nodes={graphNodes} links={graphLinks} categories={graphCategories} series={graphSeries}
      />
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZGraphChart } from '@zelviora/react-chart';
import { graphCategories, graphNodes, graphLinks, graphSeries } from '../data.ts';

export function GraphChartVariants() {
  return (
    <ZStack gap="lg">
      <ZGraphChart
        heading="Circular Network Layout"
        description="Circular ring network with curved edges vs force-directed layout with high repulsion."
        nodes={graphNodes} links={graphLinks} categories={graphCategories} series={graphSeries} graphLayout="circular" curveness={0.25}
      />
      <ZGraphChart
        heading="Force-Directed Layout"
        description="Circular ring network with curved edges vs force-directed layout with high repulsion."
        nodes={graphNodes} links={graphLinks} categories={graphCategories} series={graphSeries} graphLayout="force" repulsion={240} symbolSize={20}
      />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZCard, ZGrid } from '@zelviora/react';

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. */
export function GridAutoFill() {
  return (
    <ZGrid minColumnWidth="10rem" gap="sm">
      {files.map((file) => (
        <ZCard key={file} variant="soft" size="sm">{file}</ZCard>
      ))}
    </ZGrid>
  );
}

```

### Case: basic

#### React
```tsx
import { ZCard, ZGrid, ZGridItem } from '@zelviora/react';

/** 12 columns by default; grid items span as many as they need. */
export function GridBasic() {
  return (
    <ZGrid gap="sm">
      <ZGridItem span={12}>
        <ZCard variant="soft" size="sm">span 12</ZCard>
      </ZGridItem>
      <ZGridItem span={8}>
        <ZCard variant="soft" size="sm">span 8</ZCard>
      </ZGridItem>
      <ZGridItem span={4}>
        <ZCard variant="soft" size="sm">span 4</ZCard>
      </ZGridItem>
      <ZGridItem span={4}>
        <ZCard variant="soft" size="sm">span 4</ZCard>
      </ZGridItem>
      <ZGridItem span={4} start={9}>
        <ZCard variant="soft" size="sm">span 4, start 9</ZCard>
      </ZGridItem>
    </ZGrid>
  );
}

```

### Case: composition

#### React
```tsx
import { ZButton, ZContainer, ZGrid, ZGridItem, ZLabel, ZStack } from '@zelviora/react';

/** Two-column form inside a md container; the address spans both columns. */
export function GridComposition() {
  return (
    <ZContainer size="md" padding="none">
      <form onSubmit={(e) => e.preventDefault()}>
        <ZStack gap="lg">
          <ZGrid columns={2}>
            <ZStack gap="xs">
              <ZLabel for="grid-first">First name</ZLabel>
              <input id="grid-first" autoComplete="given-name" />
            </ZStack>
            <ZStack gap="xs">
              <ZLabel for="grid-last">Last name</ZLabel>
              <input id="grid-last" autoComplete="family-name" />
            </ZStack>
            <ZGridItem span={2}>
              <ZStack gap="xs">
                <ZLabel for="grid-address">Address</ZLabel>
                <input id="grid-address" autoComplete="street-address" />
              </ZStack>
            </ZGridItem>
          </ZGrid>
          <ZStack orientation="horizontal" justify="end" gap="sm">
            <ZButton variant="ghost" tone="neutral" type="reset">Clear</ZButton>
            <ZButton type="submit">Save</ZButton>
          </ZStack>
        </ZStack>
      </form>
    </ZContainer>
  );
}

```

### Case: gaps

#### React
```tsx
import { ZCard, ZGrid, ZStack } from '@zelviora/react';

const gaps = ['none', 'xs', 'sm', 'md', 'lg'] as const;

/** gap sets both axes; rowGap and columnGap override one axis. All follow the density tokens. */
export function GridGaps() {
  return (
    <ZStack gap="lg">
      {gaps.map((gap) => (
        <ZGrid key={gap} columns={3} gap={gap}>
          <ZCard variant="soft" size="sm">gap="{gap}"</ZCard>
          <ZCard variant="soft" size="sm">B</ZCard>
          <ZCard variant="soft" size="sm">C</ZCard>
        </ZGrid>
      ))}
      <ZGrid columns={3} rowGap="lg" columnGap="xs">
        {['1', '2', '3', '4', '5', '6'].map((n) => (
          <ZCard key={n} variant="soft" size="sm">rowGap lg, columnGap xs</ZCard>
        ))}
      </ZGrid>
    </ZStack>
  );
}

```

### Case: responsive

#### React
```tsx
import { ZCard, ZContainer, ZGrid } from '@zelviora/react';

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.
 */
export function GridResponsive() {
  return (
    <ZContainer size="full" padding="none">
      <ZGrid columns="2 lg:4">
        {plans.map((plan) => (
          <ZCard key={plan} heading={plan}>Billed monthly.</ZCard>
        ))}
      </ZGrid>
    </ZContainer>
  );
}

```


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

#### React
```tsx
import { ZHeading, ZStack, ZText } from '@zelviora/react';

export function HeadingBasic() {
  return (
    <ZStack gap="xs">
      <ZHeading level={2}>Revenue report</ZHeading>
      <ZText as="p" variant="muted">Figures updated at 08:00, Q3 2026.</ZText>
    </ZStack>
  );
}

```

### Case: prose

#### React
```tsx
export function HeadingProse() {
  return (
    <article className="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 @zelviora/react</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>
  );
}

```

### Case: sizes

#### React
```tsx
import { ZHeading, ZStack } from '@zelviora/react';

const sizes = ['xl', 'lg', 'md', 'sm'] as const;

export function HeadingSizes() {
  return (
    <ZStack gap="sm">
      {sizes.map((size) => (
        <ZHeading key={size} level={3} size={size}>
          Level 3 heading, size {size}
        </ZHeading>
      ))}
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZHeatmapChart } from '@zelviora/react-chart';
import { heatmapData, heatmapSeries } from '../data.ts';

export function HeatmapChartBasic() {
  return (
    <ZHeatmapChart
      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={heatmapData} series={heatmapSeries}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/react';
import { ZHeatmapChart } from '@zelviora/react-chart';
import { heatmapData, heatmapSeries } from '../data.ts';

export function HeatmapChartControlled() {
  const [hidden, setHidden] = useState<string[]>([]);
  const [selected, setSelected] = useState<string>('Click any chart element to inspect');

  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <ZButton
          size="sm"
          variant="outline"
          onClick={() => setHidden([])}
        >
          Show All Series
        </ZButton>
        <ZBadge tone="primary" variant="soft">
          {selected}
        </ZBadge>
        <ZText variant="muted" size="sm">
          Hidden: {hidden.length ? hidden.join(', ') : 'none'}
        </ZText>
      </ZStack>
      <ZHeatmapChart
        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={heatmapData} series={heatmapSeries}
        selectable
        hiddenSeries={hidden}
        onZSeriesToggle={(e) => setHidden(e.detail.hiddenSeries)}
        onZPointSelect={(e) =>
          setSelected(`Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`)
        }
      />
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZHeatmapChart } from '@zelviora/react-chart';
import { heatmapData, heatmapSeries } from '../data.ts';

export function HeatmapChartCustomization() {
  return (
    <ZHeatmapChart
      className="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={heatmapData} series={heatmapSeries}
    >
      <span slot="heading">Deployment Frequency by Day and Environment — Custom Theme Tokens &amp; Canvas</span>
    </ZHeatmapChart>
  );
}

```

### Case: states

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZHeatmapChart } from '@zelviora/react-chart';
import { heatmapData, heatmapSeries } from '../data.ts';

export function HeatmapChartStates() {
  return (
    <ZStack gap="lg">
      <ZHeatmapChart
        heading="Loading State (aria-busy)"
        loading
        xKey="day" yKey="env" valueKey="deploys" data={heatmapData} series={heatmapSeries}
      />
      <ZHeatmapChart
        heading="Empty State"
        data={[]}
        series={heatmapSeries}
      />
      <ZHeatmapChart
        heading="Expanded Accessible Data Table"
        description="Number of automated releases across Staging, Canary, and Production from Monday to Friday."
        showDataTable
        xKey="day" yKey="env" valueKey="deploys" data={heatmapData} series={heatmapSeries}
      />
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZHeatmapChart } from '@zelviora/react-chart';
import { heatmapData, heatmapSeries } from '../data.ts';

export function HeatmapChartVariants() {
  return (
    <ZStack gap="lg">
      <ZHeatmapChart
        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 data={heatmapData} series={heatmapSeries}
      />
      <ZHeatmapChart
        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={heatmapData} series={heatmapSeries}
      />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZAvatar, ZHoverCard, ZStack, ZText } from '@zelviora/react';

export function HoverCardDefault() {
  return (
    <p>
      Reviewed by{' '}
      <ZHoverCard>
        <a href="#profile-lan">@lan.nguyen</a>
        <ZStack slot="content" orientation="horizontal" gap="sm">
          <ZAvatar name="Anna Lee" />
          <ZStack gap="xs">
            <strong>Anna Lee</strong>
            <ZText variant="muted">Frontend engineer · Hanoi</ZText>
            <a href="#posts-lan">42 posts</a>
          </ZStack>
        </ZStack>
      </ZHoverCard>{' '}
      yesterday.
    </p>
  );
}

```

### Case: placement

#### React
```tsx
import { ZHoverCard, ZStack } from '@zelviora/react';

export function HoverCardPlacement() {
  return (
    <ZStack orientation="horizontal" wrap alignItems="center" gap="lg">
      {(['top', 'right', 'bottom', 'left'] as const).map((placement) => (
        <ZHoverCard key={placement} placement={placement} arrow 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>
        </ZHoverCard>
      ))}
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZIcon } from '@zelviora/react';

export function IconBasic() {
  return (
    <p>
      Continue to checkout <ZIcon name="chevron_right" />
    </p>
  );
}

```

### Case: composition

#### React
```tsx
import { ZButton, ZIcon, ZIconButton, ZInput, ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack } from '@zelviora/react';

/** The icon inside other components: the icon slot of a button, an icon button, the prefix of an input and sidebar items. */
export function IconComposition() {
  return (
    <ZStack gap="lg">
      <ZStack orientation="horizontal" alignItems="center" gap="md" wrap>
        <ZButton>
          <ZIcon slot="icon-start" name="save" />
          Save
        </ZButton>
        <ZIconButton label="Settings">
          <ZIcon name="settings" />
        </ZIconButton>
      </ZStack>
      <ZInput className="demo-narrow" label="Search" placeholder="Search orders">
        <ZIcon slot="prefix" name="search" />
      </ZInput>
      <ZStack orientation="horizontal" className="demo-sidebar-frame">
        <ZSidebar label="Workspace navigation">
          <ZSidebarGroup label="Workspace">
            <ZSidebarItem href="#icon-composition-dashboard" current>
              <ZIcon slot="icon" name="dashboard" />
              Dashboard
            </ZSidebarItem>
            <ZSidebarItem href="#icon-composition-orders">
              <ZIcon slot="icon" name="receipt_long" />
              Orders
            </ZSidebarItem>
          </ZSidebarGroup>
        </ZSidebar>
        <p className="demo-grow">Page content</p>
      </ZStack>
    </ZStack>
  );
}

```

### Case: label

#### React
```tsx
import { ZIcon } from '@zelviora/react';

export function IconLabel() {
  return (
    <p>
      Payment status: <ZIcon name="close" label="Failed" size="md" />
    </p>
  );
}

```

### Case: loading

#### React
```tsx
import { ZIcon, ZStack } from '@zelviora/react';

/** Same-origin sample picture served by the docs site (apps/document/public/demo-assets). */
const SAMPLE = '/demo-assets/rich-text-sample.svg';

/** A font glyph stays hidden until the icon font has loaded; a `src` icon is an empty box until its SVG has loaded. */
export function IconLoading() {
  return (
    <ZStack orientation="horizontal" alignItems="center" gap="lg" wrap>
      <span><ZIcon name="image" size="lg" /> Icon font glyph</span>
      <span><ZIcon src={SAMPLE} size="lg" /> Same-origin SVG (src)</span>
    </ZStack>
  );
}

```

### Case: registry

#### React
```tsx
import { ZIcon } from '@zelviora/react';
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,
  },
});

export function IconRegistry() {
  return (
    <p>
      <ZIcon name="app-send" size="md" /> Send message
    </p>
  );
}

```

### Case: rtl

#### React
```tsx
import { ZIcon, ZStack } from '@zelviora/react';

export function IconRtl() {
  return (
    <ZStack gap="sm">
      <p dir="ltr">
        Next <ZIcon name="chevron_right" /> · Close <ZIcon name="close" />
      </p>
      <p dir="rtl" lang="ar">
        التالي <ZIcon name="chevron_right" /> · إغلاق <ZIcon name="close" />
      </p>
    </ZStack>
  );
}

```

### Case: sizes

#### React
```tsx
import { ZIcon, ZStack } from '@zelviora/react';

export function IconSizes() {
  return (
    <ZStack orientation="horizontal" alignItems="center" gap="lg" wrap>
      <span>
        1em <ZIcon name="close" />
      </span>
      <span>
        sm <ZIcon name="close" size="sm" />
      </span>
      <span>
        md <ZIcon name="close" size="md" />
      </span>
      <span>
        lg <ZIcon name="close" size="lg" />
      </span>
    </ZStack>
  );
}

```

### Case: styles

#### React
```tsx
import { ZIcon, ZStack } from '@zelviora/react';

/** Font styles and axes of the icon font: classes of demo.css set the icon tokens (see README). */
export function IconStyles() {
  return (
    <ZStack orientation="horizontal" alignItems="center" gap="lg" wrap>
      <span><ZIcon name="settings" size="lg" /> Outlined (brand default)</span>
      <span><ZIcon name="settings" size="lg" className="demo-icon-rounded" /> Rounded</span>
      <span><ZIcon name="settings" size="lg" className="demo-icon-sharp" /> Sharp</span>
      <span><ZIcon name="star" size="lg" filled /> Filled</span>
      <span><ZIcon name="star" size="lg" className="demo-icon-bold" /> Weight 700</span>
    </ZStack>
  );
}

```

### Case: tones

#### React
```tsx
import { ZIcon, ZStack } from '@zelviora/react';

export function IconTones() {
  return (
    <ZStack orientation="horizontal" alignItems="center" gap="lg" wrap>
      {/* demo.css: .demo-text-destructive sets the text color; .demo-icon-token sets --z-icon-color. */}
      <span className="demo-text-destructive">
        <ZIcon name="close" size="md" /> Inherits the text color
      </span>
      <span>
        <ZIcon name="close" size="md" className="demo-icon-token" /> Icon color token
      </span>
    </ZStack>
  );
}

```

### Case: unknown

#### React
```tsx
import { ZIcon, ZStack } from '@zelviora/react';

/** A name that is neither registered nor in the icon font leaves an empty box of the icon size (dev warning in the console). */
export function IconUnknown() {
  return (
    <ZStack orientation="horizontal" alignItems="center" gap="lg" wrap>
      <span><ZIcon name="shopping_cart" size="lg" /> shopping_cart</span>
      <span><ZIcon name="Shopping Cart" size="lg" /> Shopping Cart (unknown name)</span>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZIcon, ZIconButton } from '@zelviora/react';

export function IconButtonBasic() {
  return (
    <ZIconButton label="Close" onClick={() => console.log('closed')}>
      <ZIcon name="close" />
    </ZIconButton>
  );
}

```

### Case: loading

#### React
```tsx
import { useState } from 'react';
import { ZIcon, ZIconButton } from '@zelviora/react';

export function IconButtonLoading() {
  const [loading, setLoading] = useState(false);
  return (
    <ZIconButton
      label="Delete"
      variant="soft"
      tone="destructive"
      loading={loading}
      onClick={() => {
        setLoading(true);
        setTimeout(() => setLoading(false), 1500);
      }}
    >
      <ZIcon name="close" />
    </ZIconButton>
  );
}

```

### Case: sizes

#### React
```tsx
import { ZIcon, ZIconButton, ZStack } from '@zelviora/react';

export function IconButtonSizes() {
  return (
    <ZStack orientation="horizontal" alignItems="center" gap="md" wrap>
      <ZIconButton label="Next" size="sm" variant="outline"><ZIcon name="chevron_right" /></ZIconButton>
      <ZIconButton label="Next" size="md" variant="outline"><ZIcon name="chevron_right" /></ZIconButton>
      <ZIconButton label="Next" size="lg" variant="outline"><ZIcon name="chevron_right" /></ZIconButton>
      <ZIconButton label="Next" size="md" variant="solid" shape="circle"><ZIcon name="chevron_right" /></ZIconButton>
    </ZStack>
  );
}

```

### Case: spa-routing

#### React
```tsx
import { useState } from 'react';
import { ZIcon, ZIconButton } from '@zelviora/react';

// SPA routing (ADR-026, D-22): an icon button with `href` emits zNavigate; the listener cancels it and calls the app
// router (here a stand-in for `router.push` of Next.js / React Router). Ctrl/⌘-click still opens a new tab.
export function IconButtonSpaRouting() {
  const [route, setRoute] = useState('#/home');
  const navigate = (e: CustomEvent<{ href: string }>) => {
    e.preventDefault();
    setRoute(e.detail.href); // router.push(e.detail.href)
  };
  return (
    <div>
      <ZIconButton label="Settings" href="#/settings" onZNavigate={navigate}>
        <ZIcon name="settings" />
      </ZIconButton>
      <p aria-live="polite">Current route: <code>{route}</code></p>
    </div>
  );
}

```

### Case: tooltip

#### React
```tsx
import { ZIcon, ZIconButton, ZStack } from '@zelviora/react';

export function IconButtonTooltip() {
  return (
    <ZStack orientation="horizontal" alignItems="center" gap="md" wrap>
      <ZIconButton label="Close" tooltip variant="outline">
        <ZIcon name="close" />
      </ZIconButton>
      <ZIconButton label="Next page" tooltip variant="outline">
        <ZIcon name="chevron_right" />
      </ZIconButton>
      <ZIconButton label="Disabled: no tooltip" tooltip variant="outline" disabled>
        <ZIcon name="close" />
      </ZIconButton>
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZIcon, ZIconButton, ZStack } from '@zelviora/react';

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

export function IconButtonVariants() {
  return (
    <ZStack orientation="horizontal" alignItems="center" gap="md" wrap>
      {variants.map((variant) => (
        <ZIconButton key={variant} label={`Close (${variant})`} variant={variant} tone="primary">
          <ZIcon name="close" />
        </ZIconButton>
      ))}
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZIconPicker, ZStack } from '@zelviora/react';

/** Programmatic control of selection and panel open state with event logging. */
export function IconPickerControlled() {
  const [value, setValue] = useState('star');
  const [open, setOpen] = useState(false);
  const [log, setLog] = useState<string[]>([]);
  const add = (line: string) => setLog((l) => [line, ...l].slice(0, 5));

  return (
    <ZStack className="demo-narrow">
      <ZIconPicker
        label="Controlled icon"
        value={value}
        open={open}
        clearable
        showName
        onZInput={(e) => {
          setValue(e.detail.value);
          add(`zInput ${e.detail.value || '(none)'}`);
        }}
        onZChange={(e) => {
          setValue(e.detail.value);
          add(`zChange ${e.detail.value || '(none)'}`);
        }}
        onZOpenChange={(e) => {
          setOpen(e.detail.open);
          add(`zOpenChange ${e.detail.open} (${e.detail.reason})`);
        }}
        onZSearch={(e) => add(`zSearch "${e.detail.query}"`)}
      />
      <ZStack orientation="horizontal" gap="sm" wrap>
        <ZButton variant="outline" tone="neutral" onClick={() => setOpen(!open)}>
          {open ? 'Close' : 'Open'}
        </ZButton>
        <ZButton variant="outline" tone="neutral" onClick={() => setValue('shopping_cart')}>
          Select cart
        </ZButton>
        <ZButton variant="outline" tone="neutral" onClick={() => setValue('')}>
          Clear
        </ZButton>
      </ZStack>
      <span>Value: {value || "''"}</span>
      <output>{log.join(' · ')}</output>
    </ZStack>
  );
}

```

### Case: custom-icons

#### React
```tsx
import { useState } from 'react';
import { ZIconPicker, ZStack } from '@zelviora/react';

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. */
export function IconPickerCustomIcons() {
  const [icon, setIcon] = useState('play_arrow');

  return (
    <ZStack className="demo-narrow">
      <ZIconPicker
        label="Media Player Icon"
        icons={MEDIA_ICONS}
        pageSize={8}
        value={icon}
        showName
        clearable
        emptyText="No media icon matches search"
        onZChange={(e) => setIcon(e.detail.value)}
      />
      <span>Selected: {icon || '(none)'}</span>
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { useState } from 'react';
import { ZIconPicker, ZStack } from '@zelviora/react';

/** Click the trigger: search and choose an icon from the popover grid. */
export function IconPickerDefault() {
  const [value, setValue] = useState('favorite');
  return (
    <ZStack className="demo-narrow">
      <ZIconPicker
        label="Favorite icon"
        placeholder="Choose an icon..."
        value={value}
        clearable
        showName
        onZChange={(e) => setValue(e.detail.value)}
      />
      <span>Selected: {value || '(none)'}</span>
    </ZStack>
  );
}

```

### Case: form

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZField, ZIconPicker, ZStack } from '@zelviora/react';

/** Native form: value submitted as icon name (FormData), required inside a field, reset restores defaults. */
export function IconPickerForm() {
  const [sent, setSent] = useState('');
  return (
    <form
      className="demo-narrow"
      onSubmit={(e) => {
        e.preventDefault();
        setSent(JSON.stringify([...new FormData(e.currentTarget).entries()]));
      }}
    >
      <ZStack>
        <ZField label="Navigation icon" hint="Icon displayed in main menu" required>
          <ZIconPicker name="navIcon" placeholder="Select an icon..." required />
        </ZField>
        <ZIconPicker name="actionIcon" label="Action icon" defaultValue="add" />
        <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
          <ZButton type="submit">Submit</ZButton>
          <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
        </ZStack>
        {sent && <output>{sent}</output>}
      </ZStack>
    </form>
  );
}

```

### Case: i18n

#### React
```tsx
import { ZConfigProvider, ZGrid, ZIconPicker } from '@zelviora/react';

/** Trigger placeholder, clear button, and dialog labels follow the locale; panel is mirrored in RTL. */
export function IconPickerI18n() {
  return (
    <ZGrid columns="1 sm:3" gap="md">
      <ZConfigProvider locale="vi">
        <ZIconPicker label="Tiếng Việt" defaultValue="settings" />
      </ZConfigProvider>
      <ZConfigProvider locale="en">
        <ZIconPicker label="English" defaultValue="settings" />
      </ZConfigProvider>
      <div dir="rtl" lang="ar-EG">
        <ZIconPicker label="العربية" defaultValue="settings" />
      </div>
    </ZGrid>
  );
}

```

### Case: states

#### React
```tsx
import { ZGrid, ZIconPicker } from '@zelviora/react';

/** Empty (placeholder), filled, clearable, disabled, readonly, invalid, and statuses. */
export function IconPickerStates() {
  return (
    <ZGrid columns="1 sm:2" gap="md">
      <ZIconPicker label="Empty" placeholder="No icon selected" />
      <ZIconPicker label="With value" defaultValue="star" />
      <ZIconPicker label="Clearable" defaultValue="search" clearable />
      <ZIconPicker label="Disabled" defaultValue="lock" disabled />
      <ZIconPicker label="Readonly" defaultValue="visibility" readonly />
      <ZIconPicker label="Invalid" defaultValue="" placeholder="Required" invalid />
      <ZIconPicker label="Warning" defaultValue="warning" status="warning" />
      <ZIconPicker label="Success" defaultValue="check_circle" status="success" />
    </ZGrid>
  );
}

```

### Case: variants

#### React
```tsx
import { ZGrid, ZIconPicker, ZStack } from '@zelviora/react';

/** Outline and filled triggers in every size, and the panel in the flow (`inline`). */
export function IconPickerVariants() {
  return (
    <ZStack gap="lg">
      <ZGrid columns="1 sm:3" gap="md">
        <ZIconPicker label="Small" size="sm" defaultValue="home" />
        <ZIconPicker label="Medium" size="md" defaultValue="home" />
        <ZIconPicker label="Large" size="lg" defaultValue="home" />
        <ZIconPicker label="Small filled" size="sm" variant="filled" defaultValue="settings" />
        <ZIconPicker label="Medium filled" size="md" variant="filled" defaultValue="settings" />
        <ZIconPicker label="Large filled" size="lg" variant="filled" defaultValue="settings" />
      </ZGrid>
      <ZIconPicker label="Inline" inline defaultValue="palette" pageSize={30} />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZGrid, ZImage, ZStack, ZText } from '@zelviora/react';

// 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";
const fits = ['cover', 'contain', 'fill', 'none', 'scale-down'] as const;

/** object-fit values in a square box, then a broken src with fallbackSrc and one without (fallback slot). */
export function ImageFit() {
  return (
    <ZGrid columns="2 md:4" gap="md">
      {fits.map((fit) => (
        <ZStack key={fit} gap="xs">
          <ZImage className="demo-square" src={PICTURE} alt={`Red circle, fit ${fit}`} fit={fit} />
          <ZText variant="muted">{fit}</ZText>
        </ZStack>
      ))}
      <ZStack gap="xs">
        <ZImage className="demo-square" src="data:image/png;base64,AAAA" fallbackSrc={PICTURE} alt="Fallback picture" />
        <ZText variant="muted">fallbackSrc</ZText>
      </ZStack>
      <ZStack gap="xs">
        <ZImage className="demo-square" src="data:image/png;base64,AAAA" alt="Product photo" />
        <ZText variant="muted">error</ZText>
      </ZStack>
    </ZGrid>
  );
}

```

### Case: preview

#### React
```tsx
import { ZImage } from '@zelviora/react';

// 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. */
export function ImagePreview() {
  return <ZImage src={PHOTO} alt="Mountains under a yellow sun" width={320} height={213} preview />;
}

```


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

#### React
```tsx
import { ZInput } from '@zelviora/react';

export function InputBasic() {
  return <ZInput label="Full name" name="fullName" placeholder="Nguyen Van A" autocomplete="name" />;
}

```

### Case: clearable

#### React
```tsx
import { ZInput, ZStack } from '@zelviora/react';

export function InputClearable() {
  return (
    <ZStack className="demo-narrow">
      <ZInput label="Dish" clearable showCount maxLength={20} defaultValue="Pho 🍜" hint="Length counts characters as you see them" />
      <ZInput label="Search" type="search" clearable placeholder="Press Escape to clear" />
    </ZStack>
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZInput, ZStack } from '@zelviora/react';

export function InputControlled() {
  const [value, setValue] = useState('');
  const [committed, setCommitted] = useState('');
  return (
    <ZStack gap="sm" className="demo-narrow">
      <ZInput
        label="Coupon code"
        value={value}
        onZInput={(e) => setValue(e.detail.value.toUpperCase())}
        onZChange={(e) => setCommitted(e.detail.value)}
      />
      <small>
        Value: {value || '—'} · Last change: {committed || '—'}
      </small>
    </ZStack>
  );
}

```

### Case: error

#### React
```tsx
import { ZButton, ZInput, ZStack } from '@zelviora/react';

export function InputError() {
  return (
    <form className="demo-narrow" onSubmit={(e) => e.preventDefault()}>
      <ZStack>
      <ZInput label="Email" name="email" type="email" required hint="Type a value, clear it and leave the field" />
      <ZInput label="Website" name="site" type="url" defaultValue="example" />
      <ZInput label="Username" name="user" status="warning" hint="This name is similar to an existing one" defaultValue="an.nguyen" />
      <ZButton type="submit">Submit</ZButton>
      </ZStack>
    </form>
  );
}

```


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

#### React
```tsx
import { ZInput, ZInputGroup, ZInputGroupAddon } from '@zelviora/react';

export function InputGroupBasic() {
  return (
    <div className="demo-narrow">
      <ZInputGroup label="Website">
        <ZInputGroupAddon>https://</ZInputGroupAddon>
        <ZInput name="site" label="Domain name" placeholder="example" />
        <ZInputGroupAddon>.com</ZInputGroupAddon>
      </ZInputGroup>
    </div>
  );
}

```

### Case: composition

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZField, ZInput, ZInputGroup, ZSelect, ZSelectOption, ZStack } from '@zelviora/react';

export function InputGroupComposition() {
  const [code, setCode] = useState('SALE');
  const error = code.trim().length < 6 ? 'The code has 6 characters.' : null;
  return (
    <ZStack gap="lg" className="demo-narrow">
      <ZInputGroup label="Price">
        <ZSelect label="Currency" defaultValue="vnd">
          <ZSelectOption value="vnd">VND</ZSelectOption>
          <ZSelectOption value="usd">USD</ZSelectOption>
        </ZSelect>
        <ZInput label="Amount" name="amount" inputMode="numeric" placeholder="0" />
      </ZInputGroup>
      <ZField label="Coupon code" hint="Applied at checkout" error={error}>
        <ZInputGroup>
          <ZInput name="coupon" value={code} onZInput={(e) => setCode(e.detail.value.toUpperCase())} />
          <ZButton variant="outline" tone="neutral">Apply</ZButton>
        </ZInputGroup>
      </ZField>
    </ZStack>
  );
}

```

### Case: controls

#### React
```tsx
import { ZCombobox, ZDatePicker, ZInputGroup, ZInputGroupAddon, ZNumberInput, ZStack } from '@zelviora/react';

const CURRENCIES = [
  { value: 'vnd', label: 'VND' },
  { value: 'usd', label: 'USD' },
  { value: 'eur', label: 'EUR' },
];

/** Combobox, number-input and date-picker join like the input: square inner corners, one shared border; RTL mirrors them. */
export function InputGroupControls() {
  return (
    <ZStack gap="lg">
      <ZInputGroup label="Transfer">
        <ZCombobox label="Currency" options={CURRENCIES} defaultValue="vnd" />
        <ZNumberInput label="Amount" defaultValue={250000} min={0} />
        <ZDatePicker label="Transfer date" />
      </ZInputGroup>
      <ZInputGroup label="Discount" size="sm">
        <ZNumberInput label="Discount" defaultValue={10} min={0} max={100} />
        <ZInputGroupAddon>%</ZInputGroupAddon>
      </ZInputGroup>
      <div dir="rtl">
        <ZInputGroup label="المبلغ">
          <ZInputGroupAddon>د.إ</ZInputGroupAddon>
          <ZNumberInput label="المبلغ" defaultValue={1200} />
          <ZDatePicker label="التاريخ" />
        </ZInputGroup>
      </div>
    </ZStack>
  );
}

```

### Case: disabled

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZInput, ZInputGroup, ZStack, ZSwitch } from '@zelviora/react';

export function InputGroupDisabled() {
  const [disabled, setDisabled] = useState(true);
  return (
    <ZStack gap="md" className="demo-narrow">
      <ZSwitch checked={disabled} onZChange={(e) => setDisabled(e.detail.checked)}>Disable the group</ZSwitch>
      <ZInputGroup label="Search" disabled={disabled}>
        <ZInput type="search" label="Search" name="q" defaultValue="invoices" />
        <ZButton>Search</ZButton>
      </ZInputGroup>
    </ZStack>
  );
}

```

### Case: sizes

#### React
```tsx
import { ZButton, ZInput, ZInputGroup, ZInputGroupAddon, ZStack } from '@zelviora/react';

const sizes = ['sm', 'md', 'lg'] as const;

export function InputGroupSizes() {
  return (
    <ZStack gap="md" className="demo-narrow">
      {sizes.map((size) => (
        <ZInputGroup key={size} size={size} label={`Amount ${size}`}>
          <ZInputGroupAddon>₫</ZInputGroupAddon>
          <ZInput label={`Amount (${size})`} placeholder="0" />
          <ZButton variant="outline" tone="neutral">Apply</ZButton>
        </ZInputGroup>
      ))}
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZKanban, ZKanbanCard, ZKanbanColumn, ZStack, ZText } from '@zelviora/react';
import { cancelledLog, controlledDemo, dragStartLog, findCard, moveCard, reorderLog } from '../data.ts';

/**
 * 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.
 */
export function KanbanControlled() {
  const [board, setBoard] = useState(controlledDemo.columns);
  const [log, setLog] = useState(controlledDemo.initialLog);
  return (
    <ZStack gap="sm">
      <ZKanban
        label={controlledDemo.label}
        onZDragStart={(e) => setLog(dragStartLog(e.detail))}
        onZReorder={(e) => {
          const d = e.detail;
          const card = findCard(board, d.from, d.value);
          if (card?.blocked && d.to !== d.from) {
            e.preventDefault();
            setLog(cancelledLog(card));
            return;
          }
          setBoard((b) => moveCard(b, d));
          setLog(reorderLog(d));
        }}
      >
        {board.map((col) => (
          <ZKanbanColumn key={col.value} value={col.value} label={col.label}>
            {col.cards.map((card) => (
              <ZKanbanCard key={card.value} value={card.value} label={card.label}>
                <ZStack gap="xs" alignItems="start">
                  <ZText>{card.label}</ZText>
                  {card.blocked ? <ZBadge tone="destructive">{controlledDemo.blocked}</ZBadge> : <ZBadge>{card.tag}</ZBadge>}
                </ZStack>
              </ZKanbanCard>
            ))}
          </ZKanbanColumn>
        ))}
      </ZKanban>
      <ZText variant="muted" size="sm">{log}</ZText>
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZKanban, ZKanbanCard, ZKanbanColumn, ZStack, ZText } from '@zelviora/react';
import { defaultDemo, moveCard } from '../data.ts';

/**
 * 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`.
 */
export function KanbanDefault() {
  const [board, setBoard] = useState(defaultDemo.columns);
  return (
    <ZKanban label={defaultDemo.label} onZReorder={(e) => setBoard((b) => moveCard(b, e.detail))}>
      {board.map((col) => (
        <ZKanbanColumn key={col.value} value={col.value} label={col.label}>
          {col.cards.map((card) => (
            <ZKanbanCard key={card.value} value={card.value} label={card.label}>
              <ZStack gap="xs" alignItems="start">
                <ZText>{card.label}</ZText>
                <ZBadge>{card.tag}</ZBadge>
              </ZStack>
            </ZKanbanCard>
          ))}
        </ZKanbanColumn>
      ))}
    </ZKanban>
  );
}

```

### Case: limits

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZKanban, ZKanbanCard, ZKanbanColumn, ZStack, ZText } from '@zelviora/react';
import { fromReview, limitsDemo, moveCard } from '../data.ts';

/**
 * `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).
 */
export function KanbanLimits() {
  const [board, setBoard] = useState(limitsDemo.columns);
  return (
    <ZKanban label={limitsDemo.label} handle onZReorder={(e) => setBoard((b) => moveCard(b, e.detail))}>
      {board.map((col) => (
        <ZKanbanColumn
          key={col.value}
          value={col.value}
          label={col.label}
          limit={col.value === limitsDemo.limitColumn ? limitsDemo.limit : undefined}
          accepts={col.value === limitsDemo.acceptsColumn ? fromReview : undefined}
        >
          {col.cards.map((card) => (
            <ZKanbanCard key={card.value} value={card.value} label={card.label} disabled={card.disabled}>
              <ZStack gap="xs" alignItems="start">
                <ZText>{card.label}</ZText>
                <ZBadge>{card.tag}</ZBadge>
              </ZStack>
            </ZKanbanCard>
          ))}
          <ZText slot="empty" variant="muted" size="sm">{limitsDemo.empty}</ZText>
        </ZKanbanColumn>
      ))}
    </ZKanban>
  );
}

```


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

#### React
```tsx
import { ZKbd, ZStack, ZText } from '@zelviora/react';

export function KbdBasic() {
  return (
    <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap={true}>
      <ZText>Close with</ZText>
      <ZKbd>Esc</ZKbd>
      <ZText>Search with</ZText>
      <ZKbd keys="Mod+K"></ZKbd>
    </ZStack>
  );
}

```

### Case: composition

#### React
```tsx
import { ZButton, ZCard, ZKbd, ZStack } from '@zelviora/react';

export function KbdComposition() {
  return (
    <ZCard heading="Editor">
      <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap={true}>
        <ZButton variant="outline" tone="neutral">Save <ZKbd keys="Mod+S"></ZKbd></ZButton>
        <ZButton variant="outline" tone="neutral">Undo <ZKbd keys="Mod+Z"></ZKbd></ZButton>
        <ZKbd className="demo-kbd-brand" keys="Shift+Enter"></ZKbd>
      </ZStack>
    </ZCard>
  );
}

```

### Case: sizes

#### React
```tsx
import { ZKbd, ZStack } from '@zelviora/react';

export function KbdSizes() {
  return (
    <ZStack orientation="horizontal" gap="md" alignItems="center">
      <ZKbd keys="Mod+S" size="sm"></ZKbd>
      <ZKbd keys="Mod+S" size="md"></ZKbd>
      <ZKbd keys="Mod+S" size="lg"></ZKbd>
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZKbd, ZStack, ZText } from '@zelviora/react';

export function KbdVariants() {
  return (
    <ZStack gap="sm">
      <ZStack orientation="horizontal" gap="sm" alignItems="center"><ZText>Symbols</ZText><ZKbd keys="Mod+Shift+P" display="symbols"></ZKbd></ZStack>
      <ZStack orientation="horizontal" gap="sm" alignItems="center"><ZText>Text</ZText><ZKbd keys="Mod+Shift+P" display="text"></ZKbd></ZStack>
      <ZStack orientation="horizontal" gap="sm" alignItems="center"><ZText>Long</ZText><ZKbd keys="Mod+Shift+Alt+ArrowUp"></ZKbd></ZStack>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZLabel, ZStack } from '@zelviora/react';

export function LabelBasic() {
  return (
    <ZStack gap="xs" className="demo-narrow">
      <ZLabel for="label-basic-email">Email</ZLabel>
      <input id="label-basic-email" type="email" />
    </ZStack>
  );
}

```

### Case: checkbox

#### React
```tsx
import { ZLabel, ZStack } from '@zelviora/react';

export function LabelCheckbox() {
  return (
    <ZStack orientation="horizontal" alignItems="center" gap="sm">
      <input id="label-terms" type="checkbox" />
      <ZLabel for="label-terms">I accept the terms</ZLabel>
    </ZStack>
  );
}

```

### Case: indicators

#### React
```tsx
import { ZLabel, ZStack } from '@zelviora/react';

export function LabelIndicators() {
  return (
    <ZStack gap="md" className="demo-narrow">
      <ZStack gap="xs">
        <ZLabel for="label-ind-name" required>Full name</ZLabel>
        <input id="label-ind-name" required aria-required="true" />
      </ZStack>
      <ZStack gap="xs">
        <ZLabel for="label-ind-phone" optional>Phone</ZLabel>
        <input id="label-ind-phone" type="tel" />
      </ZStack>
      <ZStack gap="xs">
        <ZLabel for="label-ind-code" disabled>Promo code</ZLabel>
        <input id="label-ind-code" disabled />
      </ZStack>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZLayout, ZLayoutContent, ZLayoutFooter, ZLayoutHeader, ZText } from '@zelviora/react';

// Demos sit inside the docs page, which has its own landmarks: the inner ones are switched off.
export function LayoutBasic() {
  return (
    <ZLayout>
      <ZLayoutHeader disableLandmark>
        <ZText variant="strong">Acme Admin</ZText>
      </ZLayoutHeader>
      <ZLayoutContent disableLandmark>
        <ZText as="p" className="demo-pane">Twelve orders are waiting to be shipped today.</ZText>
      </ZLayoutContent>
      <ZLayoutFooter disableLandmark>© 2026 Acme</ZLayoutFooter>
    </ZLayout>
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZLayout, ZLayoutContent, ZLayoutSider, ZStack, ZText } from '@zelviora/react';

export function LayoutControlled() {
  const [collapsed, setCollapsed] = useState(false);
  return (
    <ZStack gap="sm">
      <ZStack orientation="horizontal" alignItems="center" gap="sm">
        <ZButton size="sm" variant="outline" tone="neutral" onClick={() => setCollapsed((c) => !c)}>
          {collapsed ? 'Show filters' : 'Hide filters'}
        </ZButton>
        <ZText variant="muted" size="sm">collapsed = {String(collapsed)}</ZText>
      </ZStack>
      <ZLayout>
        <ZLayoutSider
          collapsible
          collapsed={collapsed}
          collapsedWidth="0"
          label="Demo filters"
          onZCollapseChange={(e) => setCollapsed(e.detail.collapsed)}
        >
          <ZText as="p" size="sm">Filters</ZText>
        </ZLayoutSider>
        <ZLayoutContent disableLandmark>
          <ZText as="p">With a collapsed width of 0 the sider content is inert while hidden.</ZText>
        </ZLayoutContent>
      </ZLayout>
    </ZStack>
  );
}

```

### Case: sider

#### React
```tsx
import { ZLayout, ZLayoutContent, ZLayoutHeader, ZLayoutSider, ZLink, ZStack, ZText } from '@zelviora/react';

export function LayoutSider() {
  return (
    <ZLayout>
      <ZLayoutHeader disableLandmark>
        <ZText variant="strong">Acme Admin</ZText>
      </ZLayoutHeader>
      <ZLayout>
        <ZLayoutSider collapsible landmarkRole="navigation" label="Demo navigation" width="200px">
          <ZStack gap="xs" className="demo-pane">
            <ZLink href="#layout-sider-dashboard" underline="hover">Dashboard</ZLink>
            <ZLink href="#layout-sider-orders" underline="hover">Orders</ZLink>
            <ZLink href="#layout-sider-customers" underline="hover">Customers</ZLink>
          </ZStack>
        </ZLayoutSider>
        <ZLayoutContent disableLandmark>
          <ZText as="p" className="demo-pane">The sider collapses to the token width with its button; end-side siders are placed after the content.</ZText>
        </ZLayoutContent>
        <ZLayoutSider side="end" landmarkRole="complementary" label="Demo details" width="160px">
          <ZText variant="muted" size="sm" className="demo-pane">Order #1042: paid, ships today.</ZText>
        </ZLayoutSider>
      </ZLayout>
    </ZLayout>
  );
}

```

### Case: sticky

#### React
```tsx
import { ZButton, ZLayout, ZLayoutContent, ZLayoutHeader, ZStack, ZText } from '@zelviora/react';

const rows = Array.from({ length: 12 }, (_, i) => i + 1);

export function LayoutSticky() {
  return (
    <ZLayout>
      <ZLayoutHeader sticky disableLandmark>
        <ZText variant="strong">Sticky header</ZText>
      </ZLayoutHeader>
      <ZLayoutContent disableLandmark>
        <ZStack gap="sm">
          {rows.map((n) => (
            <ZStack key={n} orientation="horizontal" alignItems="center" gap="sm">
              <ZText>Row {n}</ZText>
              <ZButton size="sm" variant="ghost" tone="neutral">Open {n}</ZButton>
            </ZStack>
          ))}
        </ZStack>
      </ZLayoutContent>
    </ZLayout>
  );
}

```


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

#### React
```tsx
import { ZLineChart } from '@zelviora/react-chart';
import { trafficData, trafficSeries } from '../data.ts';

export function LineChartBasic() {
  return (
    <ZLineChart
      heading="Monthly Active Users by Platform (Thousands)"
      description="Web and Mobile active users grows steadily from January to June."
      xKey="month" data={trafficData} series={trafficSeries}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/react';
import { ZLineChart } from '@zelviora/react-chart';
import { trafficData, trafficSeries } from '../data.ts';

export function LineChartControlled() {
  const [hidden, setHidden] = useState<string[]>([]);
  const [selected, setSelected] = useState<string>('Click any chart element to inspect');

  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <ZButton
          size="sm"
          variant="outline"
          onClick={() => setHidden([])}
        >
          Show All Series
        </ZButton>
        <ZBadge tone="primary" variant="soft">
          {selected}
        </ZBadge>
        <ZText variant="muted" size="sm">
          Hidden: {hidden.length ? hidden.join(', ') : 'none'}
        </ZText>
      </ZStack>
      <ZLineChart
        heading="Monthly Active Users by Platform (Thousands) (Interactive)"
        description="Web and Mobile active users grows steadily from January to June."
        xKey="month" data={trafficData} series={trafficSeries}
        selectable
        hiddenSeries={hidden}
        onZSeriesToggle={(e) => setHidden(e.detail.hiddenSeries)}
        onZPointSelect={(e) =>
          setSelected(`Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`)
        }
      />
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZLineChart } from '@zelviora/react-chart';
import { trafficData, trafficSeries } from '../data.ts';

export function LineChartCustomization() {
  return (
    <ZLineChart
      className="demo-chart-brand"
      description="Web and Mobile active users grows steadily from January to June."
      valueFormat={{ maximumFractionDigits: 1 }}
      xKey="month" data={trafficData} series={trafficSeries} smooth dataZoom tooltipMode="point" renderer="canvas"
    >
      <span slot="heading">Monthly Active Users by Platform (Thousands) — Custom Theme Tokens &amp; Canvas</span>
    </ZLineChart>
  );
}

```

### Case: states

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZLineChart } from '@zelviora/react-chart';
import { trafficData, trafficSeries } from '../data.ts';

export function LineChartStates() {
  return (
    <ZStack gap="lg">
      <ZLineChart
        heading="Loading State (aria-busy)"
        loading
        xKey="month" data={trafficData} series={trafficSeries}
      />
      <ZLineChart
        heading="Empty State"
        data={[]}
        series={trafficSeries}
      />
      <ZLineChart
        heading="Expanded Accessible Data Table"
        description="Web and Mobile active users grows steadily from January to June."
        showDataTable
        xKey="month" data={trafficData} series={trafficSeries}
      />
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZLineChart } from '@zelviora/react-chart';
import { trafficData, trafficSeries } from '../data.ts';

export function LineChartVariants() {
  return (
    <ZStack gap="lg">
      <ZLineChart
        heading="Smooth Spline Line"
        description="Smooth spline interpolation with enlarged symbols vs step-middle line progression."
        xKey="month" data={trafficData} series={trafficSeries} smooth symbolSize={8}
      />
      <ZLineChart
        heading="Step-Middle Line"
        description="Smooth spline interpolation with enlarged symbols vs step-middle line progression."
        xKey="month" data={trafficData} series={trafficSeries} step="middle" connectNulls
      />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZLinesChart } from '@zelviora/react-chart';
import { routeLines, routeSeries } from '../data.ts';

export function LinesChartBasic() {
  return (
    <ZLinesChart
      heading="Inter-Region Replication Routes"
      description="Data replication trajectories connecting regional hubs with animated flow particles."
      linesData={routeLines} series={routeSeries}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/react';
import { ZLinesChart } from '@zelviora/react-chart';
import { routeLines, routeSeries } from '../data.ts';

export function LinesChartControlled() {
  const [hidden, setHidden] = useState<string[]>([]);
  const [selected, setSelected] = useState<string>('Click any chart element to inspect');

  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <ZButton
          size="sm"
          variant="outline"
          onClick={() => setHidden([])}
        >
          Show All Series
        </ZButton>
        <ZBadge tone="primary" variant="soft">
          {selected}
        </ZBadge>
        <ZText variant="muted" size="sm">
          Hidden: {hidden.length ? hidden.join(', ') : 'none'}
        </ZText>
      </ZStack>
      <ZLinesChart
        heading="Inter-Region Replication Routes (Interactive)"
        description="Data replication trajectories connecting regional hubs with animated flow particles."
        linesData={routeLines} series={routeSeries}
        selectable
        hiddenSeries={hidden}
        onZSeriesToggle={(e) => setHidden(e.detail.hiddenSeries)}
        onZPointSelect={(e) =>
          setSelected(`Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`)
        }
      />
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZLinesChart } from '@zelviora/react-chart';
import { routeLines, routeSeries } from '../data.ts';

export function LinesChartCustomization() {
  return (
    <ZLinesChart
      className="demo-chart-brand"
      description="Data replication trajectories connecting regional hubs with animated flow particles."
      valueFormat={{ maximumFractionDigits: 1 }}
      linesData={routeLines} series={routeSeries} effectShow curveness={0.28} renderer="canvas"
    >
      <span slot="heading">Inter-Region Replication Routes — Custom Theme Tokens &amp; Canvas</span>
    </ZLinesChart>
  );
}

```

### Case: states

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZLinesChart } from '@zelviora/react-chart';
import { routeLines, routeSeries } from '../data.ts';

export function LinesChartStates() {
  return (
    <ZStack gap="lg">
      <ZLinesChart
        heading="Loading State (aria-busy)"
        loading
        linesData={routeLines} series={routeSeries}
      />
      <ZLinesChart
        heading="Empty State"
        linesData={[]}
        series={routeSeries}
      />
      <ZLinesChart
        heading="Expanded Accessible Data Table"
        description="Data replication trajectories connecting regional hubs with animated flow particles."
        showDataTable
        linesData={routeLines} series={routeSeries}
      />
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZLinesChart } from '@zelviora/react-chart';
import { routeLines, routeSeries } from '../data.ts';

export function LinesChartVariants() {
  return (
    <ZStack gap="lg">
      <ZLinesChart
        heading="Animated Curved Trajectories"
        description="Animated particle trail with high curvature vs static straight trajectory lines."
        linesData={routeLines} series={routeSeries} effectShow curveness={0.35}
      />
      <ZLinesChart
        heading="Static Direct Vectors"
        description="Animated particle trail with high curvature vs static straight trajectory lines."
        linesData={routeLines} series={routeSeries} effectShow={false} curveness={0}
      />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZLink } from '@zelviora/react';

export function LinkBasic() {
  return (
    <p>
      Read the <ZLink href="#details">details</ZLink> before you continue.
    </p>
  );
}

```

### Case: external

#### React
```tsx
import { ZLink } from '@zelviora/react';

export function LinkExternal() {
  return (
    <p>
      See the <ZLink href="https://www.w3.org/WAI/ARIA/apg/patterns/link/" target="_blank">ARIA link pattern</ZLink>; it
      opens in a new tab.
    </p>
  );
}

```

### Case: spa-routing

#### React
```tsx
import { useState } from 'react';
import { ZLink } from '@zelviora/react';

// SPA routing (ADR-026, D-22): one zNavigate listener calls the app router (here a stand-in for
// `router.push` of Next.js / React Router). Ctrl/⌘-click and middle click still open a new tab natively.
export function LinkSpaRouting() {
  const [route, setRoute] = useState('#/home');
  const navigate = (e: CustomEvent<{ href: string }>) => {
    e.preventDefault();
    setRoute(e.detail.href); // router.push(e.detail.href)
  };
  return (
    <div>
      <p>
        Open the <ZLink href="#/docs" onZNavigate={navigate}>documentation</ZLink> or the{' '}
        <ZLink href="#/pricing" onZNavigate={navigate}>pricing</ZLink> page without a page reload.
      </p>
      <p aria-live="polite">Current route: <code>{route}</code></p>
    </div>
  );
}

```

### Case: variants

#### React
```tsx
import { ZLink, ZStack } from '@zelviora/react';

export function LinkVariants() {
  return (
    <nav aria-label="Footer">
      <ZStack orientation="horizontal" gap="lg" wrap>
        <ZLink href="#about" underline="hover">About</ZLink>
        <ZLink href="#privacy" tone="neutral" underline="hover">Privacy</ZLink>
        <ZLink href="#terms" tone="neutral" underline="none">Terms</ZLink>
        <ZLink href="#archive" disabled>Archive</ZLink>
      </ZStack>
    </nav>
  );
}

```


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

#### React
```tsx
import { ZConfigProvider, ZList, ZListItem, ZStack } from '@zelviora/react';
import { members } from '../data.ts';

const three = members.slice(0, 3);

export function ListAppearance() {
  return (
    <ZStack gap="lg">
      <ZList label="Small, divided" size="sm" divided>{three.map((m) => <ZListItem key={m.key} heading={m.heading} description={m.description} />)}</ZList>
      <ZList label="Medium, bordered" bordered>{three.map((m) => <ZListItem key={m.key} heading={m.heading} description={m.description} />)}</ZList>
      <ZList label="Large, divided and bordered" size="lg" divided bordered>{three.map((m) => <ZListItem key={m.key} heading={m.heading} description={m.description} />)}</ZList>
      <ZConfigProvider density="compact">
        <ZList label="Compact density" divided>{three.map((m) => <ZListItem key={m.key} heading={m.heading} description={m.description} />)}</ZList>
      </ZConfigProvider>
    </ZStack>
  );
}

```

### Case: basic

#### React
```tsx
import { ZList, ZListItem } from '@zelviora/react';
import { members } from '../data.ts';

export function ListBasic() {
  return (
    <ZList label="Members">
      {members.map((m) => <ZListItem key={m.key} heading={m.heading} description={m.description} href={m.href} />)}
    </ZList>
  );
}

```

### Case: composition

#### React
```tsx
import { ZBadge, ZButton, ZDropdownMenu, ZList, ZListItem, ZMenuItem } from '@zelviora/react';
import { members } from '../data.ts';

export function ListComposition() {
  return (
    <ZList label="Team" divided bordered>
      {members.slice(0, 3).map((m, i) => (
        <ZListItem key={m.key} heading={i === 2 ? `${m.heading} — responsible for the quarterly reporting of every regional office` : m.heading} description={m.description} href={m.href}>
          <ZBadge slot="prefix" tone="primary">{m.heading.split(' ').pop()!.slice(0, 2).toUpperCase()}</ZBadge>
          <ZBadge slot="suffix" tone={i === 0 ? 'success' : 'neutral'}>{i === 0 ? 'Online' : 'Away'}</ZBadge>
          <ZDropdownMenu slot="actions">
            <ZButton slot="trigger" size="sm" variant="ghost" tone="neutral">{`Actions for ${m.heading}`}</ZButton>
            <ZMenuItem value="message">Send a message</ZMenuItem>
            <ZMenuItem value="remove">Remove from team</ZMenuItem>
          </ZDropdownMenu>
        </ZListItem>
      ))}
    </ZList>
  );
}

```

### Case: load-more

#### React
```tsx
import { useState } from 'react';
import { ZList, ZListItem } from '@zelviora/react';
import { makeItems } from '../data.ts';

const all = makeItems(40);

export function ListLoadMore() {
  const [count, setCount] = useState(10);
  const [loading, setLoading] = useState(false);
  const more = () => { setLoading(true); setTimeout(() => { setCount((c) => c + 10); setLoading(false); }, 400); };
  return (
    <ZList label="Notifications" divided loading={loading} loadMore={count < all.length} onZLoadMore={more}>
      {all.slice(0, count).map((it) => <ZListItem key={it.key} heading={it.heading} description={it.description} href={`#${it.key}`} />)}
    </ZList>
  );
}

```

### Case: rtl

#### React
```tsx
import { ZBadge, ZList, ZListItem } from '@zelviora/react';

export function ListRtl() {
  return (
    <div dir="rtl" lang="ar">
      <ZList label="الأعضاء" divided>
        <ZListItem heading="أحمد علي" description="مسؤول" href="#ahmad"><ZBadge slot="suffix">جديد</ZBadge></ZListItem>
        <ZListItem heading="فاطمة حسن" description="محررة" href="#fatima" />
      </ZList>
    </div>
  );
}

```

### Case: states

#### React
```tsx
import { ZList, ZListItem, ZStack } from '@zelviora/react';

export function ListStates() {
  return (
    <ZStack gap="lg">
      <ZList label="Loading" loading />
      <ZList label="Empty" emptyText="No members yet" />
      <ZList label="With a disabled item" divided>
        <ZListItem heading="Anna Lee" description="Active" href="#member-1" />
        <ZListItem heading="Mark Tran" description="Suspended" href="#member-2" disabled />
      </ZList>
    </ZStack>
  );
}

```

### Case: virtual

#### React
```tsx
import { ZList } from '@zelviora/react';
import { makeItems } from '../data.ts';

const items = makeItems(10_000, true);

export function ListVirtual() {
  return <ZList label="Notifications" virtual="on" maxHeight="24rem" divided items={items} />;
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZCard, ZLoadingOverlay, ZStack, ZText } from '@zelviora/react';

export function LoadingOverlayBasic() {
  const [loading, setLoading] = useState(false);
  const reload = () => {
    setLoading(true);
    setTimeout(() => setLoading(false), 2000);
  };
  return (
    <ZStack gap="md" alignItems="start">
      <ZButton onClick={reload} disabled={loading}>Reload</ZButton>
      <ZLoadingOverlay loading={loading} message="Loading orders">
        <ZCard heading="Orders">
          <ZText>42 open orders, 3 overdue.</ZText>
        </ZCard>
      </ZLoadingOverlay>
    </ZStack>
  );
}

```

### Case: fullscreen

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZLoadingOverlay } from '@zelviora/react';

export function LoadingOverlayFullscreen() {
  const [loading, setLoading] = useState(false);
  const save = () => {
    setLoading(true);
    setTimeout(() => setLoading(false), 2000);
  };
  return (
    <ZLoadingOverlay fullscreen loading={loading} message="Saving the report">
      <ZButton onClick={save}>Save report</ZButton>
    </ZLoadingOverlay>
  );
}

```

### Case: indicator

#### React
```tsx
import { ZCard, ZLoadingOverlay, ZProgress, ZText } from '@zelviora/react';

export function LoadingOverlayIndicator() {
  return (
    <ZLoadingOverlay loading={true} delay={0} message="Syncing">
      <ZCard heading="Contacts"><ZText>128 contacts</ZText></ZCard>
      <ZProgress slot="indicator" label="Syncing"></ZProgress>
    </ZLoadingOverlay>
  );
}

```


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

#### React
```tsx
import { ZMapChart } from '@zelviora/react-chart';
import { demoGeoJson, mapData, mapSeries } from '../data.ts';

export function MapChartBasic() {
  return (
    <ZMapChart
      heading="Regional Cloud Adoption Choropleth"
      description="Active enterprise deployments across four geographic zones rendered from GeoJSON polygons."
      mapName="zelviora-zones" geoJson={demoGeoJson} xKey="name" data={mapData} series={mapSeries}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/react';
import { ZMapChart } from '@zelviora/react-chart';
import { demoGeoJson, mapData, mapSeries } from '../data.ts';

export function MapChartControlled() {
  const [hidden, setHidden] = useState<string[]>([]);
  const [selected, setSelected] = useState<string>('Click any chart element to inspect');

  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <ZButton
          size="sm"
          variant="outline"
          onClick={() => setHidden([])}
        >
          Show All Series
        </ZButton>
        <ZBadge tone="primary" variant="soft">
          {selected}
        </ZBadge>
        <ZText variant="muted" size="sm">
          Hidden: {hidden.length ? hidden.join(', ') : 'none'}
        </ZText>
      </ZStack>
      <ZMapChart
        heading="Regional Cloud Adoption Choropleth (Interactive)"
        description="Active enterprise deployments across four geographic zones rendered from GeoJSON polygons."
        mapName="zelviora-zones" geoJson={demoGeoJson} xKey="name" data={mapData} series={mapSeries}
        selectable
        hiddenSeries={hidden}
        onZSeriesToggle={(e) => setHidden(e.detail.hiddenSeries)}
        onZPointSelect={(e) =>
          setSelected(`Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`)
        }
      />
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZMapChart } from '@zelviora/react-chart';
import { demoGeoJson, mapData, mapSeries } from '../data.ts';

export function MapChartCustomization() {
  return (
    <ZMapChart
      className="demo-chart-brand"
      description="Active enterprise deployments across four geographic zones rendered from GeoJSON polygons."
      valueFormat={{ maximumFractionDigits: 1 }}
      mapName="zelviora-zones" geoJson={demoGeoJson} xKey="name" min={100} max={600} renderer="canvas" data={mapData} series={mapSeries}
    >
      <span slot="heading">Regional Cloud Adoption Choropleth — Custom Theme Tokens &amp; Canvas</span>
    </ZMapChart>
  );
}

```

### Case: states

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZMapChart } from '@zelviora/react-chart';
import { demoGeoJson, mapData, mapSeries } from '../data.ts';

export function MapChartStates() {
  return (
    <ZStack gap="lg">
      <ZMapChart
        heading="Loading State (aria-busy)"
        loading
        mapName="zelviora-zones" geoJson={demoGeoJson} xKey="name" data={mapData} series={mapSeries}
      />
      <ZMapChart
        heading="Empty State"
        data={[]}
        series={mapSeries}
      />
      <ZMapChart
        heading="Expanded Accessible Data Table"
        description="Active enterprise deployments across four geographic zones rendered from GeoJSON polygons."
        showDataTable
        mapName="zelviora-zones" geoJson={demoGeoJson} xKey="name" data={mapData} series={mapSeries}
      />
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZMapChart } from '@zelviora/react-chart';
import { demoGeoJson, mapData, mapSeries } from '../data.ts';

export function MapChartVariants() {
  return (
    <ZStack gap="lg">
      <ZMapChart
        heading="Labeled Choropleth with VisualMap"
        description="Interactive roam with region labels vs clean choropleth without visualMap."
        mapName="zelviora-zones" geoJson={demoGeoJson} xKey="name" data={mapData} series={mapSeries} showLabel showVisualMap roam
      />
      <ZMapChart
        heading="Minimal Choropleth"
        description="Interactive roam with region labels vs clean choropleth without visualMap."
        mapName="zelviora-zones" geoJson={demoGeoJson} xKey="name" data={mapData} series={mapSeries} showVisualMap={false}
      />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZCard, ZMasonry } from '@zelviora/react';

// Notes of different lengths give cards of different heights.
const notes = Array.from({ length: 20 }, (_, i) => ({
  id: i + 1,
  text: 'Remember to review the quarterly numbers. '.repeat((i * 7) % 5 + 1),
}));

export function MasonryBasic() {
  return (
    <ZMasonry>
      {notes.map((n) => (
        <ZCard key={n.id} heading={`Note ${n.id}`}>
          <p>{n.text}</p>
        </ZCard>
      ))}
    </ZMasonry>
  );
}

```

### Case: columns

#### React
```tsx
import { useState } from 'react';
import { ZCard, ZMasonry, ZStack } from '@zelviora/react';

const tags = ['design', 'web', 'tokens', 'a11y', 'react', 'vue', 'angular', 'stencil', 'css', 'i18n', 'rtl', 'dark mode'];

export function MasonryColumns() {
  const [columns, setColumns] = useState(0);
  return (
    <ZStack gap="sm">
      <ZMasonry className="demo-masonry-dense" onZLayoutChange={(e) => setColumns(e.detail.columns)}>
        {tags.map((t, i) => (
          <ZCard key={t}><p>{`#${t} `.repeat(i % 3 + 1)}</p></ZCard>
        ))}
      </ZMasonry>
      <small>{columns ? `Columns now: ${columns}` : 'Resize the window to change the column count.'}</small>
    </ZStack>
  );
}

```

### Case: dynamic

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZCard, ZMasonry, ZStack } from '@zelviora/react';

let next = 4;

export function MasonryDynamic() {
  const [items, setItems] = useState([1, 2, 3]);
  return (
    <ZStack gap="sm">
      <ZStack orientation="horizontal" gap="sm">
        <ZButton onClick={() => setItems((l) => [...l, next++])}>Add card</ZButton>
        <ZButton variant="outline" tone="neutral" onClick={() => setItems((l) => l.slice(1))}>Remove first</ZButton>
      </ZStack>
      <ZMasonry order="balanced" columns={3}>
        {items.map((id) => (
          <ZCard key={id} heading={`Card ${id}`}><p>{'Some content. '.repeat((id * 5) % 6 + 1)}</p></ZCard>
        ))}
      </ZMasonry>
      {items.length === 0 && <small>No cards.</small>}
    </ZStack>
  );
}

```

### Case: order

#### React
```tsx
import { ZCard, ZGrid, ZMasonry, ZStack } from '@zelviora/react';

const notes = Array.from({ length: 10 }, (_, i) => ({ id: i + 1, text: 'Lorem ipsum dolor sit amet. '.repeat((i * 3) % 4 + 1) }));
const orders = ['dom', 'balanced'] as const;

export function MasonryOrder() {
  return (
    <ZGrid columns="1 lg:2" gap="lg">
      {orders.map((order) => (
        <ZStack key={order} gap="sm">
          <strong>order="{order}"</strong>
          <ZMasonry order={order} columns={2}>
            {notes.map((n) => (
              <ZCard key={n.id} heading={`${n.id}`}><p>{n.text}</p></ZCard>
            ))}
          </ZMasonry>
        </ZStack>
      ))}
    </ZGrid>
  );
}

```


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

#### React
```tsx
import { useRef, useState } from 'react';
import { ZMentions } from '@zelviora/react';

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. */
export function MentionsAsync() {
  const [options, setOptions] = useState<User[]>([]);
  const [loading, setLoading] = useState(false);
  const pending = useRef(0);
  return (
    <ZMentions
      className="demo-narrow"
      label="Comment (loaded from the server)"
      filter="none"
      options={options}
      loading={loading}
      onZSearch={(e) => {
        const id = ++pending.current;
        const q = e.detail.query.toLowerCase();
        setLoading(true);
        setTimeout(() => {
          if (id !== pending.current) return;
          setOptions(USERS.filter((u) => u.value.startsWith(q)));
          setLoading(false);
        }, 300);
      }}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZMentions, ZStack } from '@zelviora/react';

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. */
export function MentionsControlled() {
  const [value, setValue] = useState('Hi @Chloe ');
  const [log, setLog] = useState<string[]>([]);
  const add = (line: string) => setLog((l) => [line, ...l].slice(0, 5));
  return (
    <ZStack className="demo-narrow">
      <ZMentions
        label="Message"
        options={USERS}
        value={value}
        onZInput={(e) => setValue(e.detail.value)}
        onZSelect={(e) => {
          if (e.detail.item.value === 'tina') { e.preventDefault(); add('zSelect tina (cancelled)'); return; }
          add(`zSelect ${e.detail.item.value}`);
        }}
        onZOpenChange={(e) => add(`zOpenChange ${e.detail.open} (${e.detail.reason})`)}
      />
      <ZStack orientation="horizontal" gap="sm" wrap>
        <ZButton variant="outline" tone="neutral" onClick={() => setValue('Please review this, @Mark ')}>Set text</ZButton>
        <ZButton variant="outline" tone="neutral" onClick={() => setValue('')}>Clear</ZButton>
      </ZStack>
      <span>Value: {value}</span>
      <output>{log.join(' · ')}</output>
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZMentions } from '@zelviora/react';

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. */
export function MentionsCustomization() {
  return <ZMentions className="demo-narrow demo-mentions-brand" label="Comment" options={USERS} rows={2} />;
}

```

### Case: default

#### React
```tsx
import { useState } from 'react';
import { ZMentions, ZStack } from '@zelviora/react';

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. */
export function MentionsDefault() {
  const [value, setValue] = useState('');
  return (
    <ZStack className="demo-narrow">
      <ZMentions label="Comment" placeholder="Type @ to mention a teammate" options={USERS} value={value} onZInput={(e) => setValue(e.detail.value)} />
      <span>Value: {value}</span>
    </ZStack>
  );
}

```

### Case: form

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZCard, ZField, ZMentions, ZStack } from '@zelviora/react';

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. */
export function MentionsForm() {
  const [sent, setSent] = useState('');
  return (
    <ZCard heading="Discussion" className="demo-narrow">
      <form
        onSubmit={(e) => {
          e.preventDefault();
          setSent(JSON.stringify([...new FormData(e.currentTarget).entries()]));
        }}
      >
        <ZStack>
          <ZField label="Comment" hint="Type @ to mention a teammate" required>
            <ZMentions name="comment" options={USERS} autoResize maxRows={6} required />
          </ZField>
          <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
            <ZButton type="submit">Post comment</ZButton>
            <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
          </ZStack>
          {sent && <output>{sent}</output>}
        </ZStack>
      </form>
    </ZCard>
  );
}

```

### Case: i18n

#### React
```tsx
import { ZGrid, ZMentions } from '@zelviora/react';

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. */
export function MentionsI18n() {
  return (
    <ZGrid columns="1 sm:2" gap="md">
      <ZMentions lang="vi" label="Tiếng Việt" hint='Gõ "@an"' options={USERS} rows={2} />
      <div dir="rtl" lang="ar-EG">
        <ZMentions label="العربية" options={AR_USERS} rows={2} />
      </div>
    </ZGrid>
  );
}

```

### Case: states

#### React
```tsx
import { ZGrid, ZMentions } from '@zelviora/react';

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' },
];

/** Empty, filled, loading, no match, disabled, readonly and invalid; a long text scrolls with auto-resize. */
export function MentionsStates() {
  return (
    <ZGrid columns="1 sm:2" gap="md">
      <ZMentions label="Empty" placeholder="Type @ to mention" options={USERS} rows={2} />
      <ZMentions label="With value" defaultValue="Thanks @Ben for the review" options={USERS} rows={2} />
      <ZMentions label="Loading" hint="Type @ to see the loading state" options={[]} loading rows={2} />
      <ZMentions label="No match" hint="Type @zz" options={USERS} rows={2} />
      <ZMentions label="Disabled" defaultValue="Thanks @Ben" options={USERS} disabled rows={2} />
      <ZMentions label="Readonly" defaultValue="Thanks @Ben" options={USERS} readonly rows={2} />
      <ZMentions label="Invalid" defaultValue="Thanks @Ben" options={USERS} invalid rows={2} />
      <ZMentions
        label="Long content"
        options={USERS}
        autoResize
        maxRows={4}
        defaultValue={'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.'}
      />
    </ZGrid>
  );
}

```

### Case: triggers

#### React
```tsx
import { ZMentions } from '@zelviora/react';

/** "@" lists people, "#" lists topics: each option belongs to one trigger. */
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: '#' },
];
const TRIGGERS = ['@', '#'];

export function MentionsTriggers() {
  return <ZMentions className="demo-narrow" label="Post" hint="@ people, # topics" triggers={TRIGGERS} options={OPTIONS} rows={3} />;
}

```

### Case: validation

#### React
```tsx
import { ZButton, ZMentions, ZStack } from '@zelviora/react';

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). */
export function MentionsValidation() {
  return (
    <form className="demo-narrow" onSubmit={(e) => e.preventDefault()}>
      <ZStack>
        <ZMentions name="note" label="Note" options={USERS} required rows={2} />
        <ZMentions name="short" label="Up to 40 characters" options={USERS} maxLength={40} minLength={5} rows={2} hint="5–40 characters" />
        <ZButton type="submit">Submit</ZButton>
      </ZStack>
    </form>
  );
}

```

### Case: variants

#### React
```tsx
import { ZGrid, ZMentions } from '@zelviora/react';

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. */
export function MentionsVariants() {
  return (
    <ZGrid columns="1 sm:3" gap="md">
      <ZMentions label="Small" size="sm" options={USERS} rows={2} />
      <ZMentions label="Medium" size="md" options={USERS} rows={2} />
      <ZMentions label="Large" size="lg" options={USERS} rows={2} />
      <ZMentions label="Small filled" size="sm" variant="filled" options={USERS} rows={2} />
      <ZMentions label="Medium filled" size="md" variant="filled" options={USERS} rows={2} />
      <ZMentions label="Large filled" size="lg" variant="filled" options={USERS} rows={2} />
    </ZGrid>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZMenuItem, ZMenubar, ZMenubarMenu, ZStack } from '@zelviora/react';

/** `value` (open menu) driven by the app with zOpenChange, a disabled menu and a right-to-left menubar. */
export function MenubarControlled() {
  const [value, setValue] = useState<string | null>(null);
  return (
    <ZStack gap="md">
      <ZMenubar label="Document" value={value} onZOpenChange={(e) => setValue(e.detail.value)}>
        <ZMenubarMenu value="file" label="File">
          <ZMenuItem value="save">Save</ZMenuItem>
          <ZMenuItem value="export">Export</ZMenuItem>
        </ZMenubarMenu>
        <ZMenubarMenu value="share" label="Share" disabled>
          <ZMenuItem value="link">Copy link</ZMenuItem>
        </ZMenubarMenu>
        <ZMenubarMenu value="help" label="Help">
          <ZMenuItem value="docs">Documentation</ZMenuItem>
        </ZMenubarMenu>
      </ZMenubar>
      <ZStack orientation="horizontal" wrap alignItems="center" gap="md">
        <ZButton variant="outline" tone="neutral" onClick={() => setValue('help')}>Open “Help”</ZButton>
        <span>{`Open menu: ${value ?? 'none'}`}</span>
      </ZStack>
      <ZMenubar label="المحرر" dir="rtl" lang="ar">
        <ZMenubarMenu value="file" label="ملف">
          <ZMenuItem value="new">جديد</ZMenuItem>
          <ZMenuItem value="open">فتح</ZMenuItem>
        </ZMenubarMenu>
        <ZMenubarMenu value="edit" label="تحرير">
          <ZMenuItem value="undo">تراجع</ZMenuItem>
        </ZMenubarMenu>
      </ZMenubar>
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { useState } from 'react';
import {
  ZMenuCheckboxItem, ZMenuItem, ZMenuRadioGroup, ZMenuRadioItem, ZMenuSeparator, ZMenuSub, ZMenubar, ZMenubarMenu, ZStack,
} from '@zelviora/react';

/** File / Edit / View with shortcuts, a submenu, checkbox and radio items. One Tab stop; arrows move between menus. */
export function MenubarDefault() {
  const [last, setLast] = useState('');
  const [ruler, setRuler] = useState(true);
  const [zoom, setZoom] = useState('100');
  return (
    <ZStack gap="sm">
      <ZMenubar label="Editor" onZSelect={(e) => setLast(e.detail.value)}>
        <ZMenubarMenu value="file" label="File">
          <ZMenuItem value="new">New<kbd slot="shortcut">⌘N</kbd></ZMenuItem>
          <ZMenuItem value="open">Open…<kbd slot="shortcut">⌘O</kbd></ZMenuItem>
          <ZMenuSub>
            <ZMenuItem slot="trigger">Open recent</ZMenuItem>
            <ZMenuItem value="recent-a">notes.txt</ZMenuItem>
            <ZMenuItem value="recent-b">plan.md</ZMenuItem>
          </ZMenuSub>
          <ZMenuSeparator />
          <ZMenuItem value="print" disabled>Print…</ZMenuItem>
        </ZMenubarMenu>
        <ZMenubarMenu value="edit" label="Edit">
          <ZMenuItem value="undo">Undo<kbd slot="shortcut">⌘Z</kbd></ZMenuItem>
          <ZMenuItem value="redo">Redo<kbd slot="shortcut">⇧⌘Z</kbd></ZMenuItem>
          <ZMenuSeparator />
          <ZMenuItem value="cut">Cut</ZMenuItem>
          <ZMenuItem value="copy">Copy</ZMenuItem>
          <ZMenuItem value="paste">Paste</ZMenuItem>
        </ZMenubarMenu>
        <ZMenubarMenu value="view" label="View">
          <ZMenuCheckboxItem checked={ruler} onZChange={(e) => setRuler(e.detail.checked)}>Ruler</ZMenuCheckboxItem>
          <ZMenuSeparator />
          <ZMenuRadioGroup value={zoom} onZChange={(e) => setZoom(e.detail.value)}>
            <ZMenuRadioItem value="100">100%</ZMenuRadioItem>
            <ZMenuRadioItem value="200">200%</ZMenuRadioItem>
          </ZMenuRadioGroup>
        </ZMenubarMenu>
      </ZMenubar>
      <span>{`Last action: ${last || 'none'} · ruler ${ruler ? 'on' : 'off'} · zoom ${zoom}%`}</span>
    </ZStack>
  );
}

```

### Case: overflow

#### React
```tsx
import { ZMenuItem, ZMenubar, ZMenubarMenu, ZStack } from '@zelviora/react';

const menus = ['File', 'Edit', 'View', 'Insert', 'Format', 'Tools', 'Window', 'Help'];

/** Eight menus in a narrow column: `scroll` scrolls the bar, `menu` moves the menus that do not fit into a "…" menu. */
export function MenubarOverflow() {
  return (
    <ZStack orientation="vertical" gap="lg" className="demo-narrow">
      {(['scroll', 'menu'] as const).map((overflow) => (
        <ZMenubar key={overflow} label={`Editor (${overflow})`} overflow={overflow}>
          {menus.map((m) => (
            <ZMenubarMenu key={m} value={m.toLowerCase()} label={m}>
              <ZMenuItem value={`${m.toLowerCase()}-a`}>{m} command A</ZMenuItem>
              <ZMenuItem value={`${m.toLowerCase()}-b`}>{m} command B</ZMenuItem>
            </ZMenubarMenu>
          ))}
        </ZMenubar>
      ))}
    </ZStack>
  );
}

```

### Case: sizes

#### React
```tsx
import { ZMenuItem, ZMenubar, ZMenubarMenu, ZStack } from '@zelviora/react';

const sizes = ['sm', 'md', 'lg'] as const;

/** Sizes sm, md and lg (height and trigger padding follow the control tokens). */
export function MenubarSizes() {
  return (
    <ZStack gap="md">
      {sizes.map((size) => (
        <ZMenubar key={size} label={`Menubar ${size}`} size={size}>
          <ZMenubarMenu value="file" label="File">
            <ZMenuItem value="new">New</ZMenuItem>
          </ZMenubarMenu>
          <ZMenubarMenu value="edit" label="Edit">
            <ZMenuItem value="undo">Undo</ZMenuItem>
          </ZMenubarMenu>
        </ZMenubar>
      ))}
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useEffect, useRef, useState } from 'react';
import { ZMultiSelect, ZStack } from '@zelviora/react';

/** 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. */
export function MultiSelectAsync() {
  const [query, setQuery] = useState('');
  const [loading, setLoading] = useState(false);
  const timer = useRef<ReturnType<typeof setTimeout>>(undefined);
  useEffect(() => () => clearTimeout(timer.current), []);
  return (
    <ZStack className="demo-narrow">
      <ZMultiSelect
        label="Delivery address"
        filter="none"
        maxTagCount={4}
        loading={loading}
        options={search(query).slice(0, PAGE)}
        onZSearch={(e) => {
          const q = e.detail.query;
          clearTimeout(timer.current);
          setLoading(true);
          timer.current = setTimeout(() => { setQuery(q); setLoading(false); }, 300);
        }}
      />
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { useState } from 'react';
import { ZMultiSelect, ZSelectGroup, ZSelectOption, ZStack } from '@zelviora/react';

/** `selected` options give the initial tags; groups, a disabled option, clear all; the value keeps the order chosen. */
export function MultiSelectDefault() {
  const [value, setValue] = useState<string[]>(['ts', 'css']);
  return (
    <ZStack className="demo-narrow">
      <ZMultiSelect label="Skills" placeholder="Type to search" clearable maxTagCount={10} onZChange={(e) => setValue(e.detail.value)}>
        <ZSelectGroup label="Frontend">
          <ZSelectOption value="ts" selected>TypeScript</ZSelectOption>
          <ZSelectOption value="css" selected>CSS</ZSelectOption>
          <ZSelectOption value="react">React</ZSelectOption>
        </ZSelectGroup>
        <ZSelectGroup label="Backend">
          <ZSelectOption value="go">Go</ZSelectOption>
          <ZSelectOption value="node">Node.js</ZSelectOption>
          <ZSelectOption value="cobol" disabled>COBOL</ZSelectOption>
        </ZSelectGroup>
      </ZMultiSelect>
      <span>Value: {value.length ? value.join(', ') : 'none'}</span>
    </ZStack>
  );
}

```

### Case: large

#### React
```tsx
import { useState } from 'react';
import { ZMultiSelect, ZStack } from '@zelviora/react';

const PRODUCTS = Array.from({ length: 5000 }, (_, i) => ({ value: `sku-${i + 1}`, label: `Product ${i + 1}` }));

/** 5 000 options as data: the list is virtual (`virtual="auto"` above 200 options); chosen options become tags. */
export function MultiSelectLarge() {
  const [value, setValue] = useState<string[]>([]);
  return (
    <ZStack className="demo-narrow">
      <ZMultiSelect label="Products" placeholder="Type a number" options={PRODUCTS} clearable onZChange={(e) => setValue(e.detail.value)} />
      <span>Value: {value.length ? value.join(', ') : 'none'}</span>
    </ZStack>
  );
}

```

### Case: limits

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZMultiSelect, ZSelectOption, ZStack } from '@zelviora/react';

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. */
export function MultiSelectLimits() {
  const [sent, setSent] = useState('');
  return (
    <form
      className="demo-narrow"
      onSubmit={(e) => {
        e.preventDefault();
        setSent(JSON.stringify(new FormData(e.currentTarget).getAll('team')));
      }}
    >
      <ZStack>
        <ZMultiSelect name="team" label="Team members" hint="2 to 3 people" maxCount={3} minCount={2} maxTagCount={3}>
          {PEOPLE.map((p) => <ZSelectOption key={p} value={p.toLowerCase()}>{p}</ZSelectOption>)}
        </ZMultiSelect>
        <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
          <ZButton type="submit">Submit</ZButton>
          <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
        </ZStack>
        {sent && <output>{sent}</output>}
      </ZStack>
    </form>
  );
}

```

### Case: tags

#### React
```tsx
import { useState } from 'react';
import { ZMultiSelect, ZSelectOption, ZStack } from '@zelviora/react';

const TOPICS = [
  'Designing large-scale distributed systems',
  'Test automation',
  'Accessibility',
  'Internationalization',
  'Web performance',
  'Application security',
];
const ALL = TOPICS.map((_, i) => `t${i}`);

/** Responsive tag count in a narrow column ("+N" for the rest), a fixed max-tag-count, long labels cut with an ellipsis. */
export function MultiSelectTags() {
  const [value, setValue] = useState<string[]>(ALL);
  return (
    <ZStack className="demo-tight">
      <ZMultiSelect label="Responsive" value={value} onZChange={(e) => setValue(e.detail.value)}>
        {TOPICS.map((t, i) => <ZSelectOption key={t} value={`t${i}`}>{t}</ZSelectOption>)}
      </ZMultiSelect>
      <ZMultiSelect label="max-tag-count = 2" maxTagCount={2} value={value} onZChange={(e) => setValue(e.detail.value)}>
        {TOPICS.map((t, i) => <ZSelectOption key={t} value={`t${i}`}>{t}</ZSelectOption>)}
      </ZMultiSelect>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZNavigationMenu, ZNavigationMenuContent, ZNavigationMenuItem, ZNavigationMenuLink, ZStack } from '@zelviora/react';

/** `value` driven by the app (+ zOpenChange), click-only panels (`disableHover`) and `currentHref` following a route. */
export function NavigationMenuControlled() {
  const [value, setValue] = useState<string | null>(null);
  const [page, setPage] = useState('#navigation-menu-team');
  return (
    <ZStack gap="md">
      <ZNavigationMenu label="Company" value={value} disableHover currentHref={page} onZOpenChange={(e) => setValue(e.detail.value)}>
        <ZNavigationMenuItem value="about" label="About">
          <ZNavigationMenuContent>
            <ZNavigationMenuLink href="#navigation-menu-team">Team</ZNavigationMenuLink>
            <ZNavigationMenuLink href="#navigation-menu-careers">Careers</ZNavigationMenuLink>
          </ZNavigationMenuContent>
        </ZNavigationMenuItem>
        <ZNavigationMenuItem value="news" label="News">
          <ZNavigationMenuContent>
            <ZNavigationMenuLink href="#navigation-menu-press">Press</ZNavigationMenuLink>
            <ZNavigationMenuLink href="#navigation-menu-events">Events</ZNavigationMenuLink>
          </ZNavigationMenuContent>
        </ZNavigationMenuItem>
      </ZNavigationMenu>
      <ZStack orientation="horizontal" wrap alignItems="center" gap="md">
        <ZButton variant="outline" tone="neutral" onClick={() => setValue('news')}>Open “News”</ZButton>
        <ZButton variant="ghost" tone="neutral" onClick={() => setPage(page.endsWith('team') ? '#navigation-menu-careers' : '#navigation-menu-team')}>
          Change route
        </ZButton>
        <span>{`Open panel: ${value ?? 'none'}`}</span>
      </ZStack>
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { useState } from 'react';
import { ZGrid, ZNavigationMenu, ZNavigationMenuContent, ZNavigationMenuItem, ZNavigationMenuLink, ZStack } from '@zelviora/react';

/** Two panels (one a multi-column mega menu) and a plain link; hover or click opens, Tab walks into the open panel. */
export function NavigationMenuDefault() {
  const [open, setOpen] = useState<string | null>(null);
  return (
    <ZStack gap="sm">
      <ZNavigationMenu label="Main" currentHref="#navigation-menu-pricing" onZOpenChange={(e) => setOpen(e.detail.value)}>
        <ZNavigationMenuItem value="products" label="Products">
          <ZNavigationMenuContent>
            <ZGrid columns="2" gap="xs">
              <ZNavigationMenuLink href="#navigation-menu-analytics">Analytics</ZNavigationMenuLink>
              <ZNavigationMenuLink href="#navigation-menu-automation">Automation</ZNavigationMenuLink>
              <ZNavigationMenuLink href="#navigation-menu-reports">Reports</ZNavigationMenuLink>
              <ZNavigationMenuLink href="#navigation-menu-integrations">Integrations</ZNavigationMenuLink>
              <ZNavigationMenuLink href="#navigation-menu-security">Security</ZNavigationMenuLink>
              <ZNavigationMenuLink href="#navigation-menu-api">API</ZNavigationMenuLink>
            </ZGrid>
          </ZNavigationMenuContent>
        </ZNavigationMenuItem>
        <ZNavigationMenuItem value="resources" label="Resources">
          <ZNavigationMenuContent>
            <ZNavigationMenuLink href="#navigation-menu-docs">Documentation</ZNavigationMenuLink>
            <ZNavigationMenuLink href="#navigation-menu-blog">Blog</ZNavigationMenuLink>
            <ZNavigationMenuLink href="#navigation-menu-pricing">Pricing</ZNavigationMenuLink>
          </ZNavigationMenuContent>
        </ZNavigationMenuItem>
        <ZNavigationMenuItem value="contact">
          <ZNavigationMenuLink href="#navigation-menu-contact">Contact</ZNavigationMenuLink>
        </ZNavigationMenuItem>
      </ZNavigationMenu>
      <span>{`Open panel: ${open ?? 'none'} · current page: Pricing`}</span>
    </ZStack>
  );
}

```

### Case: spa-routing

#### React
```tsx
import { useState, type MouseEvent } from 'react';
import { ZNavigationMenu, ZNavigationMenuContent, ZNavigationMenuItem, ZNavigationMenuLink } from '@zelviora/react';

// SPA routing (ADR-026, D-23): top-level links are the app's own links (Next.js `Link`, React Router `Link`); a panel
// closes when one of its links is chosen (reason "select"); z-navigation-menu-link emits zNavigate for the router.
export function NavigationMenuSpaRouting() {
  const [route, setRoute] = useState('#/pricing');
  const navigate = (e: CustomEvent<{ href: string }>) => {
    e.preventDefault();
    setRoute(e.detail.href); // router.push(e.detail.href)
  };
  const appLink = (e: MouseEvent<HTMLAnchorElement>) => {
    if (e.ctrlKey || e.metaKey || e.shiftKey || e.button !== 0) return;
    e.preventDefault();
    setRoute(e.currentTarget.getAttribute('href')!);
  };
  return (
    <div>
      <ZNavigationMenu label="Main" currentHref={route} onZNavigate={navigate}>
        <ZNavigationMenuItem value="products" label="Products">
          <ZNavigationMenuContent>
            <ZNavigationMenuLink href="#/products/analytics">Analytics</ZNavigationMenuLink>
            <ZNavigationMenuLink href="#/products/billing">Billing</ZNavigationMenuLink>
          </ZNavigationMenuContent>
        </ZNavigationMenuItem>
        <ZNavigationMenuItem value="pricing"><a href="#/pricing" onClick={appLink}>Pricing</a></ZNavigationMenuItem>
        <ZNavigationMenuItem value="docs"><a href="#/docs" onClick={appLink}>Docs</a></ZNavigationMenuItem>
      </ZNavigationMenu>
      <p aria-live="polite">Current route: <code>{route}</code></p>
    </div>
  );
}

```

### Case: vertical

#### React
```tsx
import { ZNavigationMenu, ZNavigationMenuContent, ZNavigationMenuItem, ZNavigationMenuLink, ZStack } from '@zelviora/react';

/** Vertical orientation (panels open at the inline end; ArrowUp / ArrowDown between items) and right-to-left. */
export function NavigationMenuVertical() {
  return (
    <ZStack orientation="horizontal" wrap gap="lg">
      <ZNavigationMenu label="Sections" orientation="vertical">
        <ZNavigationMenuItem value="guides" label="Guides">
          <ZNavigationMenuContent>
            <ZNavigationMenuLink href="#navigation-menu-install">Install</ZNavigationMenuLink>
            <ZNavigationMenuLink href="#navigation-menu-theming">Theming</ZNavigationMenuLink>
          </ZNavigationMenuContent>
        </ZNavigationMenuItem>
        <ZNavigationMenuItem value="faq">
          <ZNavigationMenuLink href="#navigation-menu-faq">FAQ</ZNavigationMenuLink>
        </ZNavigationMenuItem>
      </ZNavigationMenu>
      <ZNavigationMenu label="رئيسي" dir="rtl" lang="ar">
        <ZNavigationMenuItem value="products" label="المنتجات">
          <ZNavigationMenuContent>
            <ZNavigationMenuLink href="#navigation-menu-a">تحليلات</ZNavigationMenuLink>
            <ZNavigationMenuLink href="#navigation-menu-b">تقارير</ZNavigationMenuLink>
          </ZNavigationMenuContent>
        </ZNavigationMenuItem>
        <ZNavigationMenuItem value="contact">
          <ZNavigationMenuLink href="#navigation-menu-c">اتصل بنا</ZNavigationMenuLink>
        </ZNavigationMenuItem>
      </ZNavigationMenu>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZNumberInput, ZStack } from '@zelviora/react';

/** React state drives the value (number or null) through onZInput; onZChange reports committed values. */
export function NumberInputControlled() {
  const [value, setValue] = useState<number | null>(2);
  const [committed, setCommitted] = useState<number | null>(2);
  return (
    <ZStack gap="sm" className="demo-narrow">
      <ZNumberInput
        label="Tickets"
        min={0}
        max={10}
        value={value}
        onZInput={(e) => setValue(e.detail.value)}
        onZChange={(e) => setCommitted(e.detail.value)}
      />
      <small>
        Value: {value ?? '—'} · Last change: {committed ?? '—'}
      </small>
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { ZNumberInput, ZStack } from '@zelviora/react';

/** Quantity with min/max and a unit in the suffix slot; arrows, PageUp/PageDown, Home/End and the buttons step the value. */
export function NumberInputDefault() {
  return (
    <ZStack className="demo-narrow">
      <ZNumberInput label="Quantity" name="qty" min={1} max={99} defaultValue={1} hint="1 to 99" />
      <ZNumberInput label="Weight" name="weight" min={0} step={0.1} defaultValue={0.3}>
        <span slot="suffix">kg</span>
      </ZNumberInput>
    </ZStack>
  );
}

```

### Case: error

#### React
```tsx
import { ZButton, ZNumberInput, ZStack } from '@zelviora/react';

/** Validation after blur or submit: required, range (clamp-behavior none keeps the typed value), text that does not parse. */
export function NumberInputError() {
  return (
    <form className="demo-narrow" onSubmit={(e) => e.preventDefault()}>
      <ZStack>
        <ZNumberInput label="Guests" name="guests" required hint="Type a number, clear it and leave the field" />
        <ZNumberInput label="Deposit" name="deposit" min={1000} clampBehavior="none" defaultValue={500} hint="At least 1,000" />
        <ZNumberInput label="Rooms" name="rooms" invalid defaultValue={3} hint="Forced error display" />
        <ZButton type="submit">Book</ZButton>
      </ZStack>
    </form>
  );
}

```

### Case: form

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZNumberInput, ZStack } from '@zelviora/react';

/** The form always receives the canonical string ("1234.5"), whatever the display locale. */
export function NumberInputForm() {
  const [sent, setSent] = useState('');
  return (
    <form
      className="demo-narrow"
      onSubmit={(e) => {
        e.preventDefault();
        setSent(JSON.stringify([...new FormData(e.currentTarget).entries()]));
      }}
    >
      <ZStack>
        <ZNumberInput label="Amount" name="amount" locale="de-DE" step={0.1} defaultValue={1234.5} />
        <ZNumberInput label="Rate" name="rate" formatOptions={{ style: 'percent' }} defaultValue={0.5} />
        <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
          <ZButton type="submit">Submit</ZButton>
          <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
        </ZStack>
        {sent && <output>{sent}</output>}
      </ZStack>
    </form>
  );
}

```

### Case: formats

#### React
```tsx
import { ZGrid, ZNumberInput } from '@zelviora/react';

const eur: Intl.NumberFormatOptions = { style: 'currency', currency: 'EUR' };
const usd: Intl.NumberFormatOptions = { style: 'currency', currency: 'USD' };
const percent: Intl.NumberFormatOptions = { style: 'percent' };
const km: Intl.NumberFormatOptions = { style: 'unit', unit: 'kilometer', maximumFractionDigits: 3 };

/** Intl formats: currency in de-DE and en-US, percent (the value is a ratio: 0.15 shows 15%), unit. Focus shows plain digits. */
export function NumberInputFormats() {
  return (
    <ZGrid columns="1 sm:2">
      <ZNumberInput label="Price (de-DE)" locale="de-DE" formatOptions={eur} min={0} step={0.01} defaultValue={1250} />
      <ZNumberInput label="Price (en-US)" locale="en-US" formatOptions={usd} min={0} step={0.01} defaultValue={1234.5} />
      <ZNumberInput label="Discount" formatOptions={percent} min={0} max={1} defaultValue={0.15} />
      <ZNumberInput label="Distance" formatOptions={km} min={0} step={0.001} defaultValue={42.195} />
    </ZGrid>
  );
}

```

### Case: i18n

#### React
```tsx
import { ZButton, ZConfigProvider, ZNumberInput, ZStack } from '@zelviora/react';

const vnd: Intl.NumberFormatOptions = { style: 'currency', currency: 'VND' };

/** With locale `vi` the number uses "." for thousands and "," for decimals; the required error is Vietnamese. */
export function NumberInputI18n() {
  return (
    <ZConfigProvider locale="vi">
      <form className="demo-narrow" onSubmit={(e) => e.preventDefault()}>
        <ZStack>
          <ZNumberInput label="Giá" formatOptions={vnd} min={0} step={1000} defaultValue={1250000} />
          <ZNumberInput label="Số lượng" name="qty" required hint="Xoá số rồi bấm Đặt hàng" />
          <ZButton type="submit">Đặt hàng</ZButton>
        </ZStack>
      </form>
    </ZConfigProvider>
  );
}

```

### Case: layout

#### React
```tsx
import { ZNumberInput, ZStack } from "@zelviora/react";

/** Stepper button layouts: stacked (default), horizontal, vertical, and blank. */
export function NumberInputLayout() {
  return (
    <ZStack className="demo-narrow">
      <ZNumberInput
        label="Stacked (Default)"
        buttonLayout="stacked"
        defaultValue={5}
        hint="Up and down buttons on the right"
      />
      <ZNumberInput
        label="Horizontal"
        buttonLayout="horizontal"
        defaultValue={10}
        hint="Decrement on left, increment on right"
      />
      <ZNumberInput
        label="Vertical"
        buttonLayout="vertical"
        defaultValue={3}
        hint="Increment on top, decrement on bottom"
      />
      <ZNumberInput
        label="Blank"
        buttonLayout="blank"
        defaultValue={25}
        hint="Without stepper buttons"
      />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZOtpInput, ZStack } from '@zelviora/react';

/** Six digit cells, one Tab stop; paste or SMS autofill spreads over the cells. */
export function OtpInputDefault() {
  const [code, setCode] = useState('');
  return (
    <ZStack gap="sm">
      <ZOtpInput label="Verification code" name="code" hint="Sent to your phone" onZComplete={(e) => setCode(e.detail.value)} />
      <small>Completed: {code || '—'}</small>
    </ZStack>
  );
}

```

### Case: error

#### React
```tsx
import { ZOtpInput } from '@zelviora/react';

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). */
export function OtpInputError() {
  return (
    <ZOtpInput
      label="Verification code"
      hint="Try 111111, then 123456"
      onZInput={(e) => void (e.target as OtpElement).setCustomValidity('')}
      onZComplete={async (e) => {
        const el = e.target as OtpElement;
        await el.setCustomValidity(e.detail.value === '123456' ? '' : 'Wrong code, check the latest SMS.');
        await el.reportValidity();
      }}
    />
  );
}

```

### Case: form

#### React
```tsx
import { useState } from 'react';
import { ZOtpInput, ZStack } from '@zelviora/react';

/** autoSubmit: the form is submitted as soon as every cell is filled. */
export function OtpInputForm() {
  const [sent, setSent] = useState('');
  return (
    <form
      onSubmit={(e) => {
        e.preventDefault();
        setSent(JSON.stringify([...new FormData(e.currentTarget).entries()]));
      }}
    >
      <ZStack gap="sm">
        <ZOtpInput label="Code" name="code" length={4} autoSubmit required />
        {sent && <output>{sent}</output>}
      </ZStack>
    </form>
  );
}

```

### Case: mask

#### React
```tsx
import { ZOtpInput, ZStack } from '@zelviora/react';

/** Masked PIN of four digits in the three sizes. */
export function OtpInputMask() {
  return (
    <ZStack>
      <ZOtpInput label="PIN (sm)" length={4} mask size="sm" />
      <ZOtpInput label="PIN (md)" length={4} mask />
      <ZOtpInput label="PIN (lg)" length={4} mask size="lg" variant="filled" />
    </ZStack>
  );
}

```

### Case: separator

#### React
```tsx
import { ZOtpInput, ZStack } from '@zelviora/react';

/** A separator after cell 3; letters and digits in upper case for a licence key. */
export function OtpInputSeparator() {
  return (
    <ZStack>
      <ZOtpInput label="Code" separatorAfter={3} />
      <ZOtpInput label="Licence key" length={8} separatorAfter={4} type="alphanumeric" uppercase />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZPagination, ZStack } from '@zelviora/react';

export function PaginationControlled() {
  const [page, setPage] = useState(3);
  const [pageSize, setPageSize] = useState(20);
  return (
    <ZStack gap="sm">
      <ZPagination
        total={12500}
        page={page}
        pageSize={pageSize}
        pageSizeOptions={[10, 20, 50, 100]}
        showQuickJumper
        onZPageChange={(e) => setPage(e.detail.page)}
        onZPageSizeChange={(e) => setPageSize(e.detail.pageSize)}
      />
      <p>
        Page {page}, {pageSize} per page
      </p>
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { ZPagination } from '@zelviora/react';

export function PaginationDefault() {
  return <ZPagination total={230} showFirstLast showSummary />;
}

```

### Case: links

#### React
```tsx
import { ZPagination } from '@zelviora/react';

const hrefOf = (page: number) => `#pagination-page-${page}`;

export function PaginationLinks() {
  return <ZPagination total={95} getPageHref={hrefOf} />;
}

```

### Case: simple

#### React
```tsx
import { ZPagination, ZStack } from '@zelviora/react';

export function PaginationSimple() {
  return (
    <ZStack gap="sm">
      <ZPagination total={230} simple />
      <ZPagination total={0} simple />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZParallelChart } from '@zelviora/react-chart';
import { parallelAxes, parallelData, parallelSeries } from '../data.ts';

export function ParallelChartBasic() {
  return (
    <ZParallelChart
      heading="AI Model Benchmark Trade-offs"
      description="Comparing accuracy, latency, memory footprint, and throughput across four model checkpoints."
      xKey="model" axes={parallelAxes} data={parallelData} series={parallelSeries}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/react';
import { ZParallelChart } from '@zelviora/react-chart';
import { parallelAxes, parallelData, parallelSeries } from '../data.ts';

export function ParallelChartControlled() {
  const [hidden, setHidden] = useState<string[]>([]);
  const [selected, setSelected] = useState<string>('Click any chart element to inspect');

  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <ZButton
          size="sm"
          variant="outline"
          onClick={() => setHidden([])}
        >
          Show All Series
        </ZButton>
        <ZBadge tone="primary" variant="soft">
          {selected}
        </ZBadge>
        <ZText variant="muted" size="sm">
          Hidden: {hidden.length ? hidden.join(', ') : 'none'}
        </ZText>
      </ZStack>
      <ZParallelChart
        heading="AI Model Benchmark Trade-offs (Interactive)"
        description="Comparing accuracy, latency, memory footprint, and throughput across four model checkpoints."
        xKey="model" axes={parallelAxes} data={parallelData} series={parallelSeries}
        selectable
        hiddenSeries={hidden}
        onZSeriesToggle={(e) => setHidden(e.detail.hiddenSeries)}
        onZPointSelect={(e) =>
          setSelected(`Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`)
        }
      />
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZParallelChart } from '@zelviora/react-chart';
import { parallelAxes, parallelData, parallelSeries } from '../data.ts';

export function ParallelChartCustomization() {
  return (
    <ZParallelChart
      className="demo-chart-brand"
      description="Comparing accuracy, latency, memory footprint, and throughput across four model checkpoints."
      valueFormat={{ maximumFractionDigits: 1 }}
      xKey="model" axes={parallelAxes} data={parallelData} series={parallelSeries} smooth lineOpacity={0.85} renderer="canvas"
    >
      <span slot="heading">AI Model Benchmark Trade-offs — Custom Theme Tokens &amp; Canvas</span>
    </ZParallelChart>
  );
}

```

### Case: states

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZParallelChart } from '@zelviora/react-chart';
import { parallelAxes, parallelData, parallelSeries } from '../data.ts';

export function ParallelChartStates() {
  return (
    <ZStack gap="lg">
      <ZParallelChart
        heading="Loading State (aria-busy)"
        loading
        xKey="model" axes={parallelAxes} data={parallelData} series={parallelSeries}
      />
      <ZParallelChart
        heading="Empty State"
        data={[]}
        series={parallelSeries}
      />
      <ZParallelChart
        heading="Expanded Accessible Data Table"
        description="Comparing accuracy, latency, memory footprint, and throughput across four model checkpoints."
        showDataTable
        xKey="model" axes={parallelAxes} data={parallelData} series={parallelSeries}
      />
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZParallelChart } from '@zelviora/react-chart';
import { parallelAxes, parallelData, parallelSeries } from '../data.ts';

export function ParallelChartVariants() {
  return (
    <ZStack gap="lg">
      <ZParallelChart
        heading="Smooth Coordinate Splines"
        description="Smooth parallel coordinate splines vs crisp polylines with subtle opacity."
        xKey="model" axes={parallelAxes} data={parallelData} series={parallelSeries} smooth lineOpacity={0.75}
      />
      <ZParallelChart
        heading="Crisp Polylines"
        description="Smooth parallel coordinate splines vs crisp polylines with subtle opacity."
        xKey="model" axes={parallelAxes} data={parallelData} series={parallelSeries} smooth={false} lineOpacity={0.4}
      />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZPasswordInput } from '@zelviora/react';

export function PasswordInputBasic() {
  return (
    <div className="demo-narrow">
      <ZPasswordInput label="Password" name="password" hint="Caps Lock is detected while you type" />
    </div>
  );
}

```

### Case: form

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZField, ZInput, ZPasswordInput, ZStack } from '@zelviora/react';

export function PasswordInputForm() {
  const [password, setPassword] = useState('');
  const [confirm, setConfirm] = useState('');
  const [result, setResult] = useState('');
  const mismatch = confirm !== '' && confirm !== password ? 'The passwords do not match.' : null;
  return (
    <form
      className="demo-narrow"
      onSubmit={(e) => {
        e.preventDefault();
        const data = new FormData(e.currentTarget);
        setResult(mismatch ? '' : `Submitted for ${data.get('email')} (${String(data.get('password')).length} characters)`);
      }}
    >
      <ZStack gap="md">
        <ZInput label="Email" name="email" type="email" autocomplete="username" required />
        <ZPasswordInput label="Password" name="password" autocomplete="new-password" minLength={8} required value={password} onZInput={(e) => setPassword(e.detail.value)} />
        <ZField label="Confirm password" error={mismatch}>
          <ZPasswordInput name="confirm" autocomplete="new-password" required value={confirm} onZInput={(e) => setConfirm(e.detail.value)} />
        </ZField>
        <ZStack orientation="horizontal" gap="sm">
          <ZButton type="submit">Create account</ZButton>
          <ZButton type="reset" variant="ghost" tone="neutral" onClick={() => { setPassword(''); setConfirm(''); setResult(''); }}>Reset</ZButton>
        </ZStack>
        {result && <small>{result}</small>}
      </ZStack>
    </form>
  );
}

```

### Case: states

#### React
```tsx
import { ZGrid, ZPasswordInput } from '@zelviora/react';

export function PasswordInputStates() {
  return (
    <ZGrid columns="1 md:2" gap="md">
      <ZPasswordInput label="Visible" defaultValue="correct horse" defaultVisible />
      <ZPasswordInput label="Filled, small" variant="filled" size="sm" defaultValue="secret" />
      <ZPasswordInput label="Disabled" defaultValue="secret" disabled />
      <ZPasswordInput label="Too short" defaultValue="abc" minLength={8} invalid hint="At least 8 characters" />
      <ZPasswordInput label="Without toggle" defaultValue="secret" hideToggle />
      <ZPasswordInput label="Large" size="lg" placeholder="Enter your password" />
    </ZGrid>
  );
}

```

### Case: strength

#### React
```tsx
import { useState } from 'react';
import { ZPasswordInput } from '@zelviora/react';

/** App-side strength (the library never computes it): a simple length and variety score from 0 to 4. */
function 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);
}

export function PasswordInputStrength() {
  const [value, setValue] = useState('');
  return (
    <div className="demo-narrow">
      <ZPasswordInput
        label="New password"
        autocomplete="new-password"
        value={value}
        strength={value ? score(value) : undefined}
        onZInput={(e) => setValue(e.detail.value)}
      />
    </div>
  );
}

```


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

#### React
```tsx
import { ZPictorialBarChart } from '@zelviora/react-chart';
import { rackData, rackSeries } from '../data.ts';

export function PictorialBarChartBasic() {
  return (
    <ZPictorialBarChart
      heading="Data Center Rack Capacity by Zone"
      description="Provisioned vs active server racks visualized with symbolic pictorial bars."
      xKey="zone" data={rackData} series={rackSeries}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/react';
import { ZPictorialBarChart } from '@zelviora/react-chart';
import { rackData, rackSeries } from '../data.ts';

export function PictorialBarChartControlled() {
  const [hidden, setHidden] = useState<string[]>([]);
  const [selected, setSelected] = useState<string>('Click any chart element to inspect');

  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <ZButton
          size="sm"
          variant="outline"
          onClick={() => setHidden([])}
        >
          Show All Series
        </ZButton>
        <ZBadge tone="primary" variant="soft">
          {selected}
        </ZBadge>
        <ZText variant="muted" size="sm">
          Hidden: {hidden.length ? hidden.join(', ') : 'none'}
        </ZText>
      </ZStack>
      <ZPictorialBarChart
        heading="Data Center Rack Capacity by Zone (Interactive)"
        description="Provisioned vs active server racks visualized with symbolic pictorial bars."
        xKey="zone" data={rackData} series={rackSeries}
        selectable
        hiddenSeries={hidden}
        onZSeriesToggle={(e) => setHidden(e.detail.hiddenSeries)}
        onZPointSelect={(e) =>
          setSelected(`Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`)
        }
      />
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZPictorialBarChart } from '@zelviora/react-chart';
import { rackData, rackSeries } from '../data.ts';

export function PictorialBarChartCustomization() {
  return (
    <ZPictorialBarChart
      className="demo-chart-brand"
      description="Provisioned vs active server racks visualized with symbolic pictorial bars."
      valueFormat={{ maximumFractionDigits: 1 }}
      xKey="zone" data={rackData} series={rackSeries} symbol="triangle" renderer="canvas"
    >
      <span slot="heading">Data Center Rack Capacity by Zone — Custom Theme Tokens &amp; Canvas</span>
    </ZPictorialBarChart>
  );
}

```

### Case: states

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZPictorialBarChart } from '@zelviora/react-chart';
import { rackData, rackSeries } from '../data.ts';

export function PictorialBarChartStates() {
  return (
    <ZStack gap="lg">
      <ZPictorialBarChart
        heading="Loading State (aria-busy)"
        loading
        xKey="zone" data={rackData} series={rackSeries}
      />
      <ZPictorialBarChart
        heading="Empty State"
        data={[]}
        series={rackSeries}
      />
      <ZPictorialBarChart
        heading="Expanded Accessible Data Table"
        description="Provisioned vs active server racks visualized with symbolic pictorial bars."
        showDataTable
        xKey="zone" data={rackData} series={rackSeries}
      />
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZPictorialBarChart } from '@zelviora/react-chart';
import { rackData, rackSeries } from '../data.ts';

export function PictorialBarChartVariants() {
  return (
    <ZStack gap="lg">
      <ZPictorialBarChart
        heading="Repeated Diamond Glyphs"
        description="Repeated clipped diamond glyphs vs horizontal rounded pictorial bars."
        xKey="zone" data={rackData} series={rackSeries} symbol="diamond" symbolRepeat symbolClip symbolSize={18}
      />
      <ZPictorialBarChart
        heading="Horizontal Pictorial Bars"
        description="Repeated clipped diamond glyphs vs horizontal rounded pictorial bars."
        xKey="zone" data={rackData} series={rackSeries} orientation="horizontal" symbol="roundRect"
      />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZPieChart } from '@zelviora/react-chart';
import { channelData, channelSeries } from '../data.ts';

export function PieChartBasic() {
  return (
    <ZPieChart
      heading="Traffic Acquisition Share by Channel"
      description="Organic search leads acquisition followed by Direct, Referral, and Social channels."
      xKey="channel" data={channelData} series={channelSeries}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/react';
import { ZPieChart } from '@zelviora/react-chart';
import { channelData, channelSeries } from '../data.ts';

export function PieChartControlled() {
  const [hidden, setHidden] = useState<string[]>([]);
  const [selected, setSelected] = useState<string>('Click any chart element to inspect');

  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <ZButton
          size="sm"
          variant="outline"
          onClick={() => setHidden([])}
        >
          Show All Series
        </ZButton>
        <ZBadge tone="primary" variant="soft">
          {selected}
        </ZBadge>
        <ZText variant="muted" size="sm">
          Hidden: {hidden.length ? hidden.join(', ') : 'none'}
        </ZText>
      </ZStack>
      <ZPieChart
        heading="Traffic Acquisition Share by Channel (Interactive)"
        description="Organic search leads acquisition followed by Direct, Referral, and Social channels."
        xKey="channel" data={channelData} series={channelSeries}
        selectable
        hiddenSeries={hidden}
        onZSeriesToggle={(e) => setHidden(e.detail.hiddenSeries)}
        onZPointSelect={(e) =>
          setSelected(`Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`)
        }
      />
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZPieChart } from '@zelviora/react-chart';
import { channelData, channelSeries } from '../data.ts';

export function PieChartCustomization() {
  return (
    <ZPieChart
      className="demo-chart-brand"
      description="Organic search leads acquisition followed by Direct, Referral, and Social channels."
      valueFormat={{ maximumFractionDigits: 1 }}
      xKey="channel" data={channelData} series={channelSeries} outerRadius="68%" padAngle={4} renderer="canvas"
    >
      <span slot="heading">Traffic Acquisition Share by Channel — Custom Theme Tokens &amp; Canvas</span>
    </ZPieChart>
  );
}

```

### Case: states

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZPieChart } from '@zelviora/react-chart';
import { channelData, channelSeries } from '../data.ts';

export function PieChartStates() {
  return (
    <ZStack gap="lg">
      <ZPieChart
        heading="Loading State (aria-busy)"
        loading
        xKey="channel" data={channelData} series={channelSeries}
      />
      <ZPieChart
        heading="Empty State"
        data={[]}
        series={channelSeries}
      />
      <ZPieChart
        heading="Expanded Accessible Data Table"
        description="Organic search leads acquisition followed by Direct, Referral, and Social channels."
        showDataTable
        xKey="channel" data={channelData} series={channelSeries}
      />
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZPieChart } from '@zelviora/react-chart';
import { channelData, channelSeries } from '../data.ts';

export function PieChartVariants() {
  return (
    <ZStack gap="lg">
      <ZPieChart
        heading="Nightingale Radius Rose"
        description="Nightingale radius rose chart with slice padding vs equal-angle area rose chart."
        xKey="channel" data={channelData} series={channelSeries} roseType="radius" padAngle={2}
      />
      <ZPieChart
        heading="Equal-Angle Area Rose"
        description="Nightingale radius rose chart with slice padding vs equal-angle area rose chart."
        xKey="channel" data={channelData} series={channelSeries} roseType="area" startAngle={180}
      />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZPopconfirm, ZStack } from '@zelviora/react';

/** Keeps the confirmation open while a (fake) request runs: preventDefault() on confirm, then close from state. */
export function PopconfirmAsync() {
  const [open, setOpen] = useState(false);
  const [loading, setLoading] = useState(false);

  return (
    <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
      <ZPopconfirm
        heading="Archive this project?"
        tone="warning"
        actionLabel="Archive"
        open={open}
        actionLoading={loading}
        onZOpenChange={(e) => setOpen(e.detail.open)}
        onZConfirm={(e) => {
          e.preventDefault();
          setLoading(true);
          setTimeout(() => {
            setLoading(false);
            setOpen(false);
          }, 1000);
        }}
        onZCancel={() => setLoading(false)}
      >
        <ZButton slot="trigger" variant="outline" tone="warning">
          Archive
        </ZButton>
      </ZPopconfirm>
      <ZPopconfirm heading="Send the invitation again?" tone="info" placement="bottom" actionLabel="Send">
        <ZButton slot="trigger" variant="outline" tone="info">
          Resend
        </ZButton>
      </ZPopconfirm>
      <ZPopconfirm heading="Disabled trigger never opens">
        <ZButton slot="trigger" variant="outline" tone="neutral" disabled>
          Disabled
        </ZButton>
      </ZPopconfirm>
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { ZButton, ZPopconfirm } from '@zelviora/react';

export function PopconfirmDefault() {
  return (
    <ZPopconfirm heading="Delete this row?" description="You can restore it from the trash for 30 days." tone="destructive" actionLabel="Delete">
      <ZButton slot="trigger" variant="outline" tone="destructive">
        Delete
      </ZButton>
    </ZPopconfirm>
  );
}

```


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

#### React
```tsx
import { ZButton, ZPopover, ZStack } from '@zelviora/react';

export function PopoverDefault() {
  return (
    <ZPopover heading="Filters">
      <ZButton slot="trigger" variant="outline" tone="neutral">
        Filter
      </ZButton>
      <ZStack gap="sm">
        <label>
          <input type="checkbox" name="active" /> Only active projects
        </label>
        <label>
          <input type="checkbox" name="mine" /> Only my projects
        </label>
      </ZStack>
    </ZPopover>
  );
}

```

### Case: placement

#### React
```tsx
import { ZButton, ZPopover, ZStack } from '@zelviora/react';

export function PopoverPlacement() {
  return (
    <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
      {(['top', 'right', 'bottom', 'left'] as const).map((placement) => (
        <ZPopover key={placement} label={`Placed ${placement}`} placement={placement} arrow dismissible>
          <ZButton slot="trigger" variant="outline" tone="neutral">
            {placement}
          </ZButton>
          <p>Flips and shifts to stay in the viewport.</p>
        </ZPopover>
      ))}
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZProgress } from '@zelviora/react';

export function ProgressBasic() {
  return (
    <div className="demo-narrow">
      <ZProgress label="Uploading report.pdf" value={40} showValue />
    </div>
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZProgress, ZStack, ZText } from '@zelviora/react';

export function ProgressControlled() {
  const [files, setFiles] = useState(0);
  const [done, setDone] = useState(false);
  return (
    <ZStack gap="md" className="demo-narrow">
      <ZProgress
        label="Importing files"
        value={files}
        max={10}
        valueText={`${files} of 10 files`}
        showValue
        announce
        onZComplete={() => setDone(true)}
      />
      <ZStack orientation="horizontal" alignItems="center" gap="sm">
        <ZButton size="sm" disabled={files >= 10} onClick={() => setFiles((n) => Math.min(10, n + 1))}>Import one</ZButton>
        <ZButton size="sm" variant="ghost" tone="neutral" onClick={() => { setFiles(0); setDone(false); }}>Restart</ZButton>
        <ZText variant="muted" size="sm">{done ? 'zComplete received' : 'Running'}</ZText>
      </ZStack>
    </ZStack>
  );
}

```

### Case: states

#### React
```tsx
import { ZProgress, ZStack } from '@zelviora/react';

const tones = ['primary', 'success', 'warning', 'info', 'neutral'] as const;

export function ProgressStates() {
  return (
    <ZStack gap="md" className="demo-narrow">
      <ZProgress label="Not started" value={0} showValue />
      <ZProgress label="Half way" value={50} showValue />
      <ZProgress label="Done" value={100} showValue />
      <ZProgress label="Preparing the export (indeterminate)" />
      <ZProgress label="Upload failed" value={64} tone="destructive" valueText="Failed at 64%" showValue />
      {tones.map((tone) => (
        <ZProgress key={tone} label={`Tone ${tone}`} tone={tone} value={30} />
      ))}
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZGrid, ZProgress, ZStack } from '@zelviora/react';

const sizes = ['sm', 'md', 'lg'] as const;

export function ProgressVariants() {
  return (
    <ZGrid columns="1 md:2" gap="lg">
      <ZStack gap="md">
        {sizes.map((size) => (
          <ZProgress key={size} label={`Linear ${size}`} size={size} value={60} showValue />
        ))}
        <ZProgress kind="meter" label="Disk usage" value={82} low={60} high={80} optimum={20} valueText="82 GB of 100 GB" showValue />
      </ZStack>
      <ZStack orientation="horizontal" alignItems="center" gap="lg" wrap>
        {sizes.map((size) => (
          <ZProgress key={size} shape="circle" label={`Circle ${size}`} size={size} value={75} showValue />
        ))}
        <ZProgress shape="circle" kind="meter" label="Battery" value={15} low={20} high={80} optimum={90} showValue />
      </ZStack>
    </ZGrid>
  );
}

```


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

#### React
```tsx
import { ZQrCode } from '@zelviora/react';

export function QrCodeBasic() {
  return <ZQrCode value="https://example.com/o/123" label="QR code to open order 123" />;
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZInput, ZQrCode, ZStack } from '@zelviora/react';

export function QrCodeControlled() {
  const [value, setValue] = useState('https://example.com');
  const [error, setError] = useState('');
  return (
    <ZStack gap="sm" className="demo-narrow">
      <ZInput label="Text to encode" value={value} onZInput={(e) => { setValue(e.detail.value); setError(''); }} />
      <ZQrCode value={value} label={`QR code for ${value}`} errorCorrection="H" onZError={(e) => setError(e.detail.error.message)} />
      <small>{error || `${value.length} characters`}</small>
    </ZStack>
  );
}

```

### Case: custom

#### React
```tsx
import { ZCard, ZQrCode, ZStack, ZText } from '@zelviora/react';

export function QrCodeCustom() {
  return (
    <ZCard heading="Pay 250 000 ₫" description="Scan with your banking app" className="demo-narrow">
      <ZStack alignItems="center" gap="sm">
        <ZQrCode 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" strokeWidth="2.5" strokeLinecap="round" />
          </svg>
        </ZQrCode>
        <ZText size="sm">pay.example.com/i/INV-0042</ZText>
      </ZStack>
    </ZCard>
  );
}

```

### Case: levels

#### React
```tsx
import { ZQrCode, ZStack } from '@zelviora/react';

const levels = ['L', 'M', 'Q', 'H'] as const;

export function QrCodeLevels() {
  return (
    <ZStack orientation="horizontal" wrap gap="lg">
      {levels.map((level) => (
        <ZStack key={level} gap="xs" alignItems="center">
          <ZQrCode value="https://example.com/o/123" errorCorrection={level} label={`QR code, error correction ${level}`} />
          <span>{level}</span>
        </ZStack>
      ))}
    </ZStack>
  );
}

```

### Case: sizes

#### React
```tsx
import { ZQrCode, ZStack } from '@zelviora/react';

const sizes = ['sm', 'md', 'lg'] as const;

export function QrCodeSizes() {
  return (
    <ZStack orientation="horizontal" wrap alignItems="end" gap="lg">
      {sizes.map((size) => (
        <ZQrCode key={size} size={size} value="https://example.com" label={`QR code, size ${size}`} />
      ))}
    </ZStack>
  );
}

```

### Case: states

#### React
```tsx
import { useState } from 'react';
import { ZQrCode, ZStack } from '@zelviora/react';

export function QrCodeStates() {
  const [token, setToken] = useState(1);
  const [status, setStatus] = useState<'expired' | 'loading' | 'active'>('expired');
  const refresh = () => {
    setStatus('loading');
    // A real app requests a new login token here.
    queueMicrotask(() => {
      setToken((t) => t + 1);
      setStatus('active');
    });
  };
  return (
    <ZStack orientation="horizontal" wrap gap="lg">
      <ZQrCode value={`login-token-${token}`} label="Login QR code" status={status} onZRefresh={refresh} />
      <ZQrCode value="login-token" label="Login QR code (loading)" status="loading" />
      <ZQrCode value="login-token" label="Login QR code (scanned)" status="scanned" />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZRadarChart } from '@zelviora/react-chart';
import { radarIndicators, radarData, radarSeries } from '../data.ts';

export function RadarChartBasic() {
  return (
    <ZRadarChart
      heading="Platform Readiness Assessment"
      description="Multi-dimensional capability comparison between Release v1 and Release v2."
      xKey="metric" indicators={radarIndicators} data={radarData} series={radarSeries}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/react';
import { ZRadarChart } from '@zelviora/react-chart';
import { radarIndicators, radarData, radarSeries } from '../data.ts';

export function RadarChartControlled() {
  const [hidden, setHidden] = useState<string[]>([]);
  const [selected, setSelected] = useState<string>('Click any chart element to inspect');

  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <ZButton
          size="sm"
          variant="outline"
          onClick={() => setHidden([])}
        >
          Show All Series
        </ZButton>
        <ZBadge tone="primary" variant="soft">
          {selected}
        </ZBadge>
        <ZText variant="muted" size="sm">
          Hidden: {hidden.length ? hidden.join(', ') : 'none'}
        </ZText>
      </ZStack>
      <ZRadarChart
        heading="Platform Readiness Assessment (Interactive)"
        description="Multi-dimensional capability comparison between Release v1 and Release v2."
        xKey="metric" indicators={radarIndicators} data={radarData} series={radarSeries}
        selectable
        hiddenSeries={hidden}
        onZSeriesToggle={(e) => setHidden(e.detail.hiddenSeries)}
        onZPointSelect={(e) =>
          setSelected(`Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`)
        }
      />
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZRadarChart } from '@zelviora/react-chart';
import { radarIndicators, radarData, radarSeries } from '../data.ts';

export function RadarChartCustomization() {
  return (
    <ZRadarChart
      className="demo-chart-brand"
      description="Multi-dimensional capability comparison between Release v1 and Release v2."
      valueFormat={{ maximumFractionDigits: 1 }}
      xKey="metric" indicators={radarIndicators} data={radarData} series={radarSeries} radarShape="circle" areaOpacity={0.4} renderer="canvas"
    >
      <span slot="heading">Platform Readiness Assessment — Custom Theme Tokens &amp; Canvas</span>
    </ZRadarChart>
  );
}

```

### Case: states

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZRadarChart } from '@zelviora/react-chart';
import { radarIndicators, radarData, radarSeries } from '../data.ts';

export function RadarChartStates() {
  return (
    <ZStack gap="lg">
      <ZRadarChart
        heading="Loading State (aria-busy)"
        loading
        xKey="metric" indicators={radarIndicators} data={radarData} series={radarSeries}
      />
      <ZRadarChart
        heading="Empty State"
        data={[]}
        series={radarSeries}
      />
      <ZRadarChart
        heading="Expanded Accessible Data Table"
        description="Multi-dimensional capability comparison between Release v1 and Release v2."
        showDataTable
        xKey="metric" indicators={radarIndicators} data={radarData} series={radarSeries}
      />
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZRadarChart } from '@zelviora/react-chart';
import { radarIndicators, radarData, radarSeries } from '../data.ts';

export function RadarChartVariants() {
  return (
    <ZStack gap="lg">
      <ZRadarChart
        heading="Circular Radar Grid"
        description="Circular radar web with filled area vs polygon radar outline."
        xKey="metric" indicators={radarIndicators} data={radarData} series={radarSeries} radarShape="circle" areaOpacity={0.32}
      />
      <ZRadarChart
        heading="Polygon Radar Grid"
        description="Circular radar web with filled area vs polygon radar outline."
        xKey="metric" indicators={radarIndicators} data={radarData} series={radarSeries} radarShape="polygon" areaOpacity={0.1}
      />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZRadioGroup, ZRadioGroupItem, ZStack } from '@zelviora/react';

export function RadioGroupDefault() {
  const [value, setValue] = useState('standard');
  return (
    <ZStack>
      <ZRadioGroup name="shipping" label="Shipping method" value={value} onZChange={(e) => setValue(e.detail.value)}>
        <ZRadioGroupItem value="standard">Standard<span slot="hint">3–5 business days</span></ZRadioGroupItem>
        <ZRadioGroupItem value="express">Express<span slot="hint">Next business day</span></ZRadioGroupItem>
        <ZRadioGroupItem value="pickup" disabled>Store pickup</ZRadioGroupItem>
      </ZRadioGroup>
      <p>Selected: {value}</p>
    </ZStack>
  );
}

```

### Case: horizontal

#### React
```tsx
import { ZRadioGroup, ZRadioGroupItem } from '@zelviora/react';

export function RadioGroupHorizontal() {
  return (
    <ZRadioGroup name="priority" label="Priority" orientation="horizontal" required hint="Arrow keys move and select.">
      <ZRadioGroupItem value="low">Low</ZRadioGroupItem>
      <ZRadioGroupItem value="medium">Medium</ZRadioGroupItem>
      <ZRadioGroupItem value="high">High</ZRadioGroupItem>
    </ZRadioGroup>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZGrid, ZNumberInput, ZRangeSlider, ZStack } from '@zelviora/react';

/** A range in React state shared with two number-inputs. */
export function RangeSliderControlled() {
  const [range, setRange] = useState<[number, number]>([20, 60]);
  return (
    <ZStack className="demo-narrow">
      <ZRangeSlider label="Temperature" value={range} onZInput={(e) => setRange(e.detail.value)} />
      <ZGrid columns="2">
        <ZNumberInput label="From" min={0} max={range[1]} value={range[0]} onZInput={(e) => setRange([e.detail.value ?? 0, range[1]])} />
        <ZNumberInput label="To" min={range[0]} max={100} value={range[1]} onZInput={(e) => setRange([range[0], e.detail.value ?? 100])} />
      </ZGrid>
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { ZRangeSlider, ZStack } from '@zelviora/react';

/** Two thumbs that never cross; each thumb is a Tab stop named after the group label. */
export function RangeSliderDefault() {
  return (
    <ZStack className="demo-narrow">
      <ZRangeSlider label="Age" start={20} end={80} hint="Drag either thumb" />
      <ZRangeSlider label="Hours" min={0} max={24} start={9} end={17} showValue="always" />
    </ZStack>
  );
}

```

### Case: form

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZRangeSlider, ZStack } from '@zelviora/react';

/** Two FormData entries under the same name, start then end (getAll('price')). */
export function RangeSliderForm() {
  const [sent, setSent] = useState('');
  return (
    <form
      className="demo-narrow"
      onSubmit={(e) => {
        e.preventDefault();
        setSent(JSON.stringify(new FormData(e.currentTarget).getAll('price')));
      }}
    >
      <ZStack>
        <ZRangeSlider label="Price" name="price" min={0} max={500} step={10} start={100} end={300} />
        <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
          <ZButton type="submit">Filter</ZButton>
          <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
        </ZStack>
        {sent && <output>{sent}</output>}
      </ZStack>
    </form>
  );
}

```

### Case: i18n

#### React
```tsx
import { ZRangeSlider } from '@zelviora/react';

const vnd = (v: number, locale: string) => new Intl.NumberFormat(locale, { style: 'currency', currency: 'VND' }).format(v);

/** `lang="vi"`: values formatted as VND; minDistance keeps the thumbs at least 100.000 ₫ apart. */
export function RangeSliderI18n() {
  return (
    <div className="demo-narrow" lang="vi">
      <ZRangeSlider label="Khoảng giá" min={0} max={1000000} step={10000} minDistance={100000} start={200000} end={800000} formatValue={vnd} />
    </div>
  );
}

```

### Case: min-distance

#### React
```tsx
import { ZRangeSlider } from '@zelviora/react';

const usd = (v: number, locale: string) => new Intl.NumberFormat(locale, { style: 'currency', currency: 'USD', maximumFractionDigits: 0 }).format(v);

/** minDistance keeps the thumbs at least $100 apart; values formatted as US dollars. */
export function RangeSliderMinDistance() {
  return (
    <div className="demo-narrow">
      <ZRangeSlider label="Price range" min={0} max={1000} step={10} minDistance={100} start={200} end={800} formatValue={usd} />
    </div>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZRating, ZStack } from '@zelviora/react';

/** The app owns `value`: buttons set it from code (no event); hover preview and user changes are logged. */
export function RatingControlled() {
  const [value, setValue] = useState(2);
  const [log, setLog] = useState<string[]>([]);
  const add = (line: string) => setLog((l) => [line, ...l].slice(0, 5));
  return (
    <ZStack className="demo-narrow">
      <ZRating
        label="Service quality"
        value={value}
        onZChange={(e) => { setValue(e.detail.value); add(`zChange ${e.detail.value}`); }}
        onZHoverChange={(e) => add(`zHoverChange ${e.detail.value}`)}
      />
      <ZStack orientation="horizontal" gap="sm" wrap>
        <ZButton variant="outline" tone="neutral" onClick={() => setValue(5)}>Set 5</ZButton>
        <ZButton variant="outline" tone="neutral" onClick={() => setValue(0)}>Clear</ZButton>
      </ZStack>
      <span>Value: {value}</span>
      <output>{log.join(' · ')}</output>
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZRating, ZStack } from '@zelviora/react';
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. */
export function RatingCustomization() {
  return (
    <ZStack>
      <ZRating className="demo-rating-heart" label="Favorite" icon="app-heart" defaultValue={4} />
      <ZRating className="demo-rating-heart" label="Favorite (half)" icon="app-heart" allowHalf defaultValue={2.5} />
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { useState } from 'react';
import { ZRating, ZStack } from '@zelviora/react';

/** Five stars: click or use the arrow keys; choosing the selected star again (or Delete) clears the rating. */
export function RatingDefault() {
  const [value, setValue] = useState(0);
  return (
    <ZStack className="demo-narrow">
      <ZRating label="Product rating" value={value} onZChange={(e) => setValue(e.detail.value)} />
      <span>Value: {value}</span>
    </ZStack>
  );
}

```

### Case: display

#### React
```tsx
import { ZRating, ZStack } from '@zelviora/react';

/** `readonly` shows a score as one image ("4.3 out of 5 stars"), drawn to the nearest half star; not focusable. */
export function RatingDisplay() {
  return (
    <ZStack>
      <ZRating label="Average score" readonly defaultValue={4.3} />
      <ZRating label="No ratings yet" readonly defaultValue={0} />
    </ZStack>
  );
}

```

### Case: form

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZCard, ZField, ZRating, ZStack, ZTextarea } from '@zelviora/react';

/** A review form: the rating is submitted as a number (no entry when 0), required inside a field; reset restores defaults. */
export function RatingForm() {
  const [sent, setSent] = useState('');
  return (
    <ZCard heading="Order review" className="demo-narrow">
      <form
        onSubmit={(e) => {
          e.preventDefault();
          setSent(JSON.stringify([...new FormData(e.currentTarget).entries()]));
        }}
      >
        <ZStack>
          <ZField label="Product quality" required>
            <ZRating name="quality" required />
          </ZField>
          <ZRating name="delivery" label="Delivery" defaultValue={4} />
          <ZTextarea name="comment" label="Comment" rows={3} />
          <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
            <ZButton type="submit">Submit</ZButton>
            <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
          </ZStack>
          {sent && <output>{sent}</output>}
        </ZStack>
      </form>
    </ZCard>
  );
}

```

### Case: half

#### React
```tsx
import { useState } from 'react';
import { ZRating, ZStack } from '@zelviora/react';

/** `allowHalf`: one slider with steps of 0.5 (click the left or right half of a star, or use the arrow keys). */
export function RatingHalf() {
  const [value, setValue] = useState(2.5);
  return (
    <ZStack className="demo-narrow">
      <ZRating label="Rating" allowHalf value={value} onZChange={(e) => setValue(e.detail.value)} />
      <span>Value: {value}</span>
    </ZStack>
  );
}

```

### Case: i18n

#### React
```tsx
import { ZConfigProvider, ZGrid, ZRating } from '@zelviora/react';

/** Level names and numbers follow the locale ("3,5 sao" / "3.5 stars"); half stars follow the direction in RTL. */
export function RatingI18n() {
  return (
    <ZGrid columns="1 sm:3" gap="md">
      <ZConfigProvider locale="vi">
        <ZRating label="Tiếng Việt" allowHalf defaultValue={3.5} />
      </ZConfigProvider>
      <ZConfigProvider locale="en">
        <ZRating label="English" allowHalf defaultValue={3.5} />
      </ZConfigProvider>
      <div dir="rtl" lang="ar-EG">
        <ZRating label="العربية" allowHalf defaultValue={3.5} />
      </div>
    </ZGrid>
  );
}

```

### Case: sizes

#### React
```tsx
import { ZRating, ZStack } from '@zelviora/react';

/** Small, medium and large; ten levels in a narrow column wrap without overflowing. */
export function RatingSizes() {
  return (
    <ZStack>
      <ZRating label="Small" size="sm" defaultValue={4} />
      <ZRating label="Medium" size="md" defaultValue={4} />
      <ZRating label="Large" size="lg" defaultValue={4} />
      <ZRating className="demo-narrow" label="Ten levels" count={10} defaultValue={7} />
    </ZStack>
  );
}

```

### Case: states

#### React
```tsx
import { ZGrid, ZRating } from '@zelviora/react';

/** Empty, rated, disabled, readonly (display mode, not focusable) and invalid; hover a star to preview it. */
export function RatingStates() {
  return (
    <ZGrid columns="1 sm:2" gap="md">
      <ZRating label="Empty" />
      <ZRating label="Rated" defaultValue={3} />
      <ZRating label="Disabled" defaultValue={3} disabled />
      <ZRating label="Readonly" defaultValue={3} readonly />
      <ZRating label="Invalid" defaultValue={3} invalid />
      <ZRating label="With hint" defaultValue={2} hint="Hover to preview, click to rate" />
    </ZGrid>
  );
}

```

### Case: tones

#### React
```tsx
import { ZRating, ZStack } from '@zelviora/react';

/** Warning is the default (traditional yellow stars); any tone colors the selected levels. */
export function RatingTones() {
  return (
    <ZStack>
      <ZRating label="Warning" defaultValue={3} />
      <ZRating label="Primary" tone="primary" defaultValue={3} />
      <ZRating label="Destructive" tone="destructive" defaultValue={3} />
    </ZStack>
  );
}

```

### Case: validation

#### React
```tsx
import { ZButton, ZRating, ZStack } from '@zelviora/react';

/** A required rating left at 0 is reported on submit ("Please choose a rating."). */
export function RatingValidation() {
  return (
    <form className="demo-narrow" onSubmit={(e) => e.preventDefault()}>
      <ZStack>
        <ZRating name="score" label="Satisfaction" required />
        <ZButton type="submit">Submit</ZButton>
      </ZStack>
    </form>
  );
}

```


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

#### React
```tsx
import { ZResult } from '@zelviora/react';

export function ResultBasic() {
  return <ZResult />;
}

```

### Case: custom

#### React
```tsx
import { ZButton, ZResult } from '@zelviora/react';

export function ResultCustom() {
  return (
    <ZResult status="404" headingLevel={1}>
      <svg slot="icon" viewBox="0 0 64 64" width="96" height="96" fill="none" stroke="currentColor" strokeWidth="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>
      <ZButton slot="actions">Go to home page</ZButton>
      <ZButton slot="actions" variant="ghost" tone="neutral">Report a problem</ZButton>
    </ZResult>
  );
}

```

### Case: in-form

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZField, ZForm, ZInput, ZResult, ZStack } from '@zelviora/react';

export function ResultInForm() {
  const [order, setOrder] = useState('');
  if (order) {
    return (
      <ZResult live="polite" status="success" heading="Order placed" description={`Order number: ${order}`}>
        <ZButton slot="actions" onClick={() => setOrder('')}>Place another order</ZButton>
      </ZResult>
    );
  }
  return (
    <ZForm preventSubmit onZSubmit={() => setOrder('DH-0001')}>
      <form className="demo-narrow">
        <ZStack>
          <ZField label="Email" required>
            <ZInput name="email" type="email" required />
          </ZField>
          <ZButton type="submit">Place order</ZButton>
        </ZStack>
      </form>
    </ZForm>
  );
}

```

### Case: sizes

#### React
```tsx
import { ZCard, ZGrid, ZResult } from '@zelviora/react';

const sizes = ['sm', 'md', 'lg'] as const;

export function ResultSizes() {
  return (
    <ZGrid columns="1 md:3" gap="md">
      {sizes.map((size) => (
        <ZCard key={size}>
          <ZResult size={size} status="success" headingLevel={3} heading={`Size ${size}`} description="Payment received." />
        </ZCard>
      ))}
    </ZGrid>
  );
}

```

### Case: statuses

#### React
```tsx
import { ZButton, ZCard, ZGrid, ZResult } from '@zelviora/react';

const statuses = ['success', 'error', 'warning', 'info', '403', '404', '500'] as const;

export function ResultStatuses() {
  return (
    <ZGrid columns="1 md:2" gap="md">
      {statuses.map((status) => (
        <ZCard key={status}>
          <ZResult status={status} headingLevel={3}>
            <ZButton slot="actions" variant="outline" tone="neutral">Back to home</ZButton>
          </ZResult>
        </ZCard>
      ))}
    </ZGrid>
  );
}

```


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

#### React
```tsx
import '@zelviora/third-party/rich-text';
import { ZRichTextEditor } from '@zelviora/react/third-party';

/** Importing `@zelviora/third-party/rich-text` once registers the editor engine and the HTML sanitizer (optional peers). */
export function RichTextEditorBasic() {
  return (
    <div className="demo-narrow">
      <ZRichTextEditor label="Description" name="description" placeholder="Write a short description…" />
    </div>
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import '@zelviora/third-party/rich-text';
import { ZStack } from '@zelviora/react';
import { ZRichTextEditor } from '@zelviora/react/third-party';

/** Controlled value: always sanitized HTML (`''` when empty), updated on every change (zInput). */
export function RichTextEditorControlled() {
  const [html, setHtml] = useState('<p>Hello <strong>world</strong></p>');
  return (
    <div className="demo-narrow">
      <ZStack>
        <ZRichTextEditor label="Message" value={html} onZInput={(e) => setHtml(e.detail.value)} />
        <output>{html || '(empty)'}</output>
      </ZStack>
    </div>
  );
}

```

### Case: customization

#### React
```tsx
import { useRef } from 'react';
import '@zelviora/third-party/rich-text';
import { ZButton } from '@zelviora/react';
import { ZRichTextEditor } from '@zelviora/react/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).
 */
export function RichTextEditorCustomization() {
  const ref = useRef<HTMLZRichTextEditorElement>(null);
  return (
    <div className="demo-narrow">
      <ZRichTextEditor ref={ref} className="demo-rich-text-brand" label="Release notes" toolbar={['bold', 'italic', 'bulletList', 'link']} defaultValue="<p>Version 2.0 is out.</p>">
        <ZButton slot="toolbar-end" size="sm" variant="ghost" tone="neutral" onClick={() => void ref.current?.exec({ type: 'heading', level: 3 })}>
          Subheading
        </ZButton>
        <ZButton slot="toolbar-end" size="sm" variant="ghost" tone="neutral" onClick={() => void ref.current?.exec({ type: 'paragraph' })}>
          Plain text
        </ZButton>
      </ZRichTextEditor>
    </div>
  );
}

```

### Case: density

#### React
```tsx
import '@zelviora/third-party/rich-text';
import { ZConfigProvider, ZGrid } from '@zelviora/react';
import { ZRichTextEditor } from '@zelviora/react/third-party';

const densities = ['compact', 'default', 'comfortable'] as const;

/** Density of the nearest config provider sets the toolbar and frame spacing. */
export function RichTextEditorDensity() {
  return (
    <ZGrid columns="1 md:3" gap="lg">
      {densities.map((density) => (
        <ZConfigProvider key={density} density={density}>
          <ZRichTextEditor label={`Density: ${density}`} defaultValue="<p>Short note.</p>" />
        </ZConfigProvider>
      ))}
    </ZGrid>
  );
}

```

### Case: form

#### React
```tsx
import { useState } from 'react';
import '@zelviora/third-party/rich-text';
import { ZButton, ZField, ZForm, ZStack } from '@zelviora/react';
import { ZRichTextEditor } from '@zelviora/react/third-party';

/** Inside a field (core) the editor (third-party build) gets the label, hint and error; it submits sanitized HTML. */
export function RichTextEditorForm() {
  const [sent, setSent] = useState('');
  return (
    <ZForm summary preventSubmit onZSubmit={(e) => setSent(JSON.stringify(e.detail.values))}>
      <form className="demo-narrow">
        <ZStack>
          <ZField label="Product description" hint="At most 200 characters" required>
            <ZRichTextEditor name="body" required maxLength={200} />
          </ZField>
          <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
            <ZButton type="submit">Save</ZButton>
            <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
          </ZStack>
          {sent && <output>{sent}</output>}
        </ZStack>
      </form>
    </ZForm>
  );
}

```

### Case: i18n

#### React
```tsx
import '@zelviora/third-party/rich-text';
import { ZConfigProvider } from '@zelviora/react';
import { ZRichTextEditor } from '@zelviora/react/third-party';

/** Tool labels and messages follow the locale; Vietnamese input methods (Telex, VNI) compose without losing characters. */
export function RichTextEditorI18n() {
  return (
    <ZConfigProvider locale="vi">
      <div className="demo-narrow">
        <ZRichTextEditor label="Nội dung" maxLength={120} placeholder="Gõ tiếng Việt (Telex, VNI)…" defaultValue="<p>Xin chào!</p>" />
      </div>
    </ZConfigProvider>
  );
}

```

### Case: images

#### React
```tsx
import { useState } from 'react';
import '@zelviora/third-party/rich-text';
import { ZStack } from '@zelviora/react';
import { ZRichTextEditor } from '@zelviora/react/third-party';

/** 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).
 */
export function RichTextEditorImages() {
  const [log, setLog] = useState<string[]>([]);
  return (
    <div className="demo-narrow">
      <ZStack>
        <ZRichTextEditor
          label="Post"
          placeholder="Paste or drop an image here…"
          defaultValue={START}
          onZFileInsert={async (e) => {
            const editor = e.target;
            for (const file of e.detail.files) {
              if (!file.type.startsWith('image/')) { setLog((l) => [`${file.name}: skipped (not an image)`, ...l]); continue; }
              const url = await upload(file);
              await editor.insertImage(url, file.name);
              setLog((l) => [`${file.name} (${Math.round(file.size / 1024)} kB) → ${url}`, ...l]);
            }
          }}
        />
        <output>{log.length ? log.join(' · ') : 'No file yet'}</output>
      </ZStack>
    </div>
  );
}

```

### Case: long

#### React
```tsx
import '@zelviora/third-party/rich-text';
import { ZRichTextEditor } from '@zelviora/react/third-party';
import { longDocument } from '../data.ts';

/** About 5 000 words and a long URL without spaces; the editing area scrolls (demo-rich-text-long, ::part(editor)). */
export function RichTextEditorLong() {
  return <ZRichTextEditor className="demo-rich-text-long" label="Annual report" defaultValue={longDocument} />;
}

```

### Case: rtl

#### React
```tsx
import '@zelviora/third-party/rich-text';
import { ZRichTextEditor } from '@zelviora/react/third-party';
import { arabicText } from '../data.ts';

/** RTL: the toolbar and the text start on the right; arrow keys in the toolbar follow the reading order. */
export function RichTextEditorRtl() {
  return (
    <div dir="rtl" lang="ar" className="demo-narrow">
      <ZRichTextEditor label="المحتوى" defaultValue={arabicText} />
    </div>
  );
}

```

### Case: states

#### React
```tsx
import '@zelviora/third-party/rich-text';
import { ZStack } from '@zelviora/react';
import { ZRichTextEditor } from '@zelviora/react/third-party';

/** Disabled: no editing and out of the tab order. Read-only: the text can be selected and copied, not changed. */
export function RichTextEditorStates() {
  return (
    <div className="demo-narrow">
      <ZStack>
        <ZRichTextEditor label="Disabled" disabled defaultValue="<p>Nothing to change here.</p>" />
        <ZRichTextEditor label="Read-only" readonly defaultValue="<p>Select and copy <em>this</em> text.</p>" />
      </ZStack>
    </div>
  );
}

```

### Case: theme

#### React
```tsx
import '@zelviora/third-party/rich-text';
import { ZCard, ZConfigProvider, ZGrid, ZGridItem } from '@zelviora/react';
import { ZRichTextEditor } from '@zelviora/react/third-party';

const value = '<p>Some <strong>bold</strong>, <em>italic</em> and <a href="https://example.com">a link</a>.</p>';

/** Light and dark side by side: the frame, toolbar and text colors come from tokens. */
export function RichTextEditorTheme() {
  return (
    <ZGrid columns="1 md:2" gap="lg">
      <ZGridItem>
        <ZConfigProvider theme="light">
          <ZCard><ZRichTextEditor label="Light" defaultValue={value} /></ZCard>
        </ZConfigProvider>
      </ZGridItem>
      <ZGridItem>
        <ZConfigProvider theme="dark">
          <ZCard><ZRichTextEditor label="Dark" defaultValue={value} /></ZCard>
        </ZConfigProvider>
      </ZGridItem>
    </ZGrid>
  );
}

```

### Case: toolbar

#### React
```tsx
import '@zelviora/third-party/rich-text';
import { ZStack } from '@zelviora/react';
import { ZRichTextEditor } from '@zelviora/react/third-party';
import type { ZRichTextTool } from '@zelviora/third-party';

const minimal: ZRichTextTool[] = ['bold', 'italic', 'link'];
const full: ZRichTextTool[] = ['bold', 'italic', 'underline', 'strike', 'code', 'separator', 'heading', 'bulletList', 'orderedList', 'blockquote', 'separator', 'link', 'separator', 'undo', 'redo'];

/** The toolbar lists the tools in order; Alt+F10 moves to it and the arrow keys move between tools. */
export function RichTextEditorToolbar() {
  return (
    <div className="demo-narrow">
      <ZStack>
        <ZRichTextEditor label="Comment (minimal toolbar)" toolbar={minimal} />
        <ZRichTextEditor label="Article (full toolbar)" toolbar={full} defaultValue="<h2>Title</h2><p>Some <strong>bold</strong> and <code>code</code>.</p>" />
      </ZStack>
    </div>
  );
}

```


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

#### React
```tsx
import { ZSankeyChart } from '@zelviora/react-chart';
import { sankeyNodes, sankeyLinks, sankeySeries } from '../data.ts';

export function SankeyChartBasic() {
  return (
    <ZSankeyChart
      heading="User Acquisition to Conversion Flow"
      description="Flow of sessions from acquisition channels through product onboarding to paid plans."
      nodes={sankeyNodes} links={sankeyLinks} series={sankeySeries}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/react';
import { ZSankeyChart } from '@zelviora/react-chart';
import { sankeyNodes, sankeyLinks, sankeySeries } from '../data.ts';

export function SankeyChartControlled() {
  const [hidden, setHidden] = useState<string[]>([]);
  const [selected, setSelected] = useState<string>('Click any chart element to inspect');

  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <ZButton
          size="sm"
          variant="outline"
          onClick={() => setHidden([])}
        >
          Show All Series
        </ZButton>
        <ZBadge tone="primary" variant="soft">
          {selected}
        </ZBadge>
        <ZText variant="muted" size="sm">
          Hidden: {hidden.length ? hidden.join(', ') : 'none'}
        </ZText>
      </ZStack>
      <ZSankeyChart
        heading="User Acquisition to Conversion Flow (Interactive)"
        description="Flow of sessions from acquisition channels through product onboarding to paid plans."
        nodes={sankeyNodes} links={sankeyLinks} series={sankeySeries}
        selectable
        hiddenSeries={hidden}
        onZSeriesToggle={(e) => setHidden(e.detail.hiddenSeries)}
        onZPointSelect={(e) =>
          setSelected(`Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`)
        }
      />
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZSankeyChart } from '@zelviora/react-chart';
import { sankeyNodes, sankeyLinks, sankeySeries } from '../data.ts';

export function SankeyChartCustomization() {
  return (
    <ZSankeyChart
      className="demo-chart-brand"
      description="Flow of sessions from acquisition channels through product onboarding to paid plans."
      valueFormat={{ maximumFractionDigits: 1 }}
      nodes={sankeyNodes} links={sankeyLinks} series={sankeySeries} nodeAlign="right" renderer="canvas"
    >
      <span slot="heading">User Acquisition to Conversion Flow — Custom Theme Tokens &amp; Canvas</span>
    </ZSankeyChart>
  );
}

```

### Case: states

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZSankeyChart } from '@zelviora/react-chart';
import { sankeyNodes, sankeyLinks, sankeySeries } from '../data.ts';

export function SankeyChartStates() {
  return (
    <ZStack gap="lg">
      <ZSankeyChart
        heading="Loading State (aria-busy)"
        loading
        nodes={sankeyNodes} links={sankeyLinks} series={sankeySeries}
      />
      <ZSankeyChart
        heading="Empty State"
        nodes={[]} links={[]}
        series={sankeySeries}
      />
      <ZSankeyChart
        heading="Expanded Accessible Data Table"
        description="Flow of sessions from acquisition channels through product onboarding to paid plans."
        showDataTable
        nodes={sankeyNodes} links={sankeyLinks} series={sankeySeries}
      />
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZSankeyChart } from '@zelviora/react-chart';
import { sankeyNodes, sankeyLinks, sankeySeries } from '../data.ts';

export function SankeyChartVariants() {
  return (
    <ZStack gap="lg">
      <ZSankeyChart
        heading="Left-Aligned Horizontal Sankey"
        description="Left-aligned horizontal flow vs top-to-bottom vertical Sankey flow."
        nodes={sankeyNodes} links={sankeyLinks} series={sankeySeries} nodeAlign="left" sankeyOrient="horizontal"
      />
      <ZSankeyChart
        heading="Vertical Flow Sankey"
        description="Left-aligned horizontal flow vs top-to-bottom vertical Sankey flow."
        nodes={sankeyNodes} links={sankeyLinks} series={sankeySeries} sankeyOrient="vertical" nodeAlign="justify"
      />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZScatterChart } from '@zelviora/react-chart';
import { latencyData, latencySeries } from '../data.ts';

export function ScatterChartBasic() {
  return (
    <ZScatterChart
      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={latencyData} series={latencySeries}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/react';
import { ZScatterChart } from '@zelviora/react-chart';
import { latencyData, latencySeries } from '../data.ts';

export function ScatterChartControlled() {
  const [hidden, setHidden] = useState<string[]>([]);
  const [selected, setSelected] = useState<string>('Click any chart element to inspect');

  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <ZButton
          size="sm"
          variant="outline"
          onClick={() => setHidden([])}
        >
          Show All Series
        </ZButton>
        <ZBadge tone="primary" variant="soft">
          {selected}
        </ZBadge>
        <ZText variant="muted" size="sm">
          Hidden: {hidden.length ? hidden.join(', ') : 'none'}
        </ZText>
      </ZStack>
      <ZScatterChart
        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={latencyData} series={latencySeries}
        selectable
        hiddenSeries={hidden}
        onZSeriesToggle={(e) => setHidden(e.detail.hiddenSeries)}
        onZPointSelect={(e) =>
          setSelected(`Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`)
        }
      />
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZScatterChart } from '@zelviora/react-chart';
import { latencyData, latencySeries } from '../data.ts';

export function ScatterChartCustomization() {
  return (
    <ZScatterChart
      className="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={latencyData} series={latencySeries} dataZoom symbolSize={14} renderer="canvas"
    >
      <span slot="heading">API Response Time vs Payload Size — Custom Theme Tokens &amp; Canvas</span>
    </ZScatterChart>
  );
}

```

### Case: states

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZScatterChart } from '@zelviora/react-chart';
import { latencyData, latencySeries } from '../data.ts';

export function ScatterChartStates() {
  return (
    <ZStack gap="lg">
      <ZScatterChart
        heading="Loading State (aria-busy)"
        loading
        xKey="payloadKb" data={latencyData} series={latencySeries}
      />
      <ZScatterChart
        heading="Empty State"
        data={[]}
        series={latencySeries}
      />
      <ZScatterChart
        heading="Expanded Accessible Data Table"
        description="Median (p50) and 95th percentile (p95) latency across payload sizes from 10 kB to 320 kB."
        showDataTable
        xKey="payloadKb" data={latencyData} series={latencySeries}
      />
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZScatterChart } from '@zelviora/react-chart';
import { latencyData, latencySeries } from '../data.ts';

export function ScatterChartVariants() {
  return (
    <ZStack gap="lg">
      <ZScatterChart
        heading="Bubble Size Dimension"
        description="Bubble sizing driven by a data dimension (sizeKey) vs compact uniform markers."
        xKey="payloadKb" data={latencyData} series={latencySeries} sizeKey="weight" symbolSize={18}
      />
      <ZScatterChart
        heading="Compact Point Markers"
        description="Bubble sizing driven by a data dimension (sizeKey) vs compact uniform markers."
        xKey="payloadKb" data={latencyData} series={latencySeries} symbolSize={8} tooltipMode="point"
      />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZScrollArea, ZStack } from '@zelviora/react';

const branches = Array.from({ length: 50 }, (_, i) => `Branch ${i + 1}`);

export function ScrollAreaDefault() {
  const [top, setTop] = useState(0);
  return (
    <ZStack gap="sm" className="demo-narrow">
      <ZScrollArea label="Branches" className="demo-scroll-area" onZScrollEnd={(e) => setTop(Math.round(e.detail.scrollTop))}>
        {branches.map((b) => (
          <p key={b}>{b}</p>
        ))}
      </ZScrollArea>
      <p>Scrolled to: {top}px</p>
    </ZStack>
  );
}

```

### Case: fade-edges

#### React
```tsx
import { ZScrollArea } from '@zelviora/react';

const lines = Array.from({ length: 30 }, (_, i) => `Notification ${i + 1}`);

export function ScrollAreaFadeEdges() {
  return (
    <ZScrollArea scrollbar="hidden" fadeEdges label="Notifications" className="demo-scroll-area demo-narrow">
      {lines.map((l) => (
        <p key={l}>{l}</p>
      ))}
    </ZScrollArea>
  );
}

```

### Case: horizontal

#### React
```tsx
import { ZBadge, ZScrollArea, ZStack } from '@zelviora/react';

const tags = Array.from({ length: 30 }, (_, i) => `Tag ${i + 1}`);

export function ScrollAreaHorizontal() {
  return (
    <ZScrollArea orientation="horizontal" label="Tags" className="demo-narrow">
      <ZStack orientation="horizontal" gap="sm">
        {tags.map((t) => (
          <ZBadge key={t}>{t}</ZBadge>
        ))}
      </ZStack>
    </ZScrollArea>
  );
}

```


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

#### React
```tsx
import { ZSegmented, ZSegmentedItem } from '@zelviora/react';

export function SegmentedBlock() {
  return (
    <ZSegmented label="Delivery" block defaultValue="standard">
      <ZSegmentedItem value="standard">Standard delivery (3–5 business days)</ZSegmentedItem>
      <ZSegmentedItem value="express">Express delivery (next business day)</ZSegmentedItem>
      <ZSegmentedItem value="pickup" disabled>
        Store pickup
      </ZSegmentedItem>
    </ZSegmented>
  );
}

```

### Case: default

#### React
```tsx
import { useState } from 'react';
import { ZSegmented, ZSegmentedItem, ZStack } from '@zelviora/react';

export function SegmentedDefault() {
  const [value, setValue] = useState<string | null>('week');
  return (
    <ZStack gap="sm">
      <ZSegmented label="Calendar view" value={value} onZChange={(e) => setValue(e.detail.value)}>
        <ZSegmentedItem value="day">Day</ZSegmentedItem>
        <ZSegmentedItem value="week">Week</ZSegmentedItem>
        <ZSegmentedItem value="month">Month</ZSegmentedItem>
      </ZSegmented>
      <p>View: {value}</p>
    </ZStack>
  );
}

```

### Case: icon-only

#### React
```tsx
import { ZIcon, ZSegmented, ZSegmentedItem } from '@zelviora/react';

export function SegmentedIconOnly() {
  return (
    <ZSegmented label="Layout" size="sm" defaultValue="grid">
      <ZSegmentedItem value="grid" label="Grid">
        <ZIcon slot="icon" name="grid_view" />
      </ZSegmentedItem>
      <ZSegmentedItem value="list" label="List">
        <ZIcon slot="icon" name="view_list" />
      </ZSegmentedItem>
    </ZSegmented>
  );
}

```

### Case: in-form

#### React
```tsx
import { useState, type FormEvent } from 'react';
import { ZButton, ZSegmented, ZSegmentedItem, ZStack } from '@zelviora/react';

export function SegmentedInForm() {
  const [sent, setSent] = useState('');
  const submit = (e: FormEvent<HTMLFormElement>) => {
    e.preventDefault();
    setSent(String(new FormData(e.currentTarget).get('period')));
  };
  return (
    <form onSubmit={submit}>
      <ZStack gap="sm" alignItems="start">
        <ZSegmented name="period" label="Billing period" required>
          <ZSegmentedItem value="monthly">Monthly</ZSegmentedItem>
          <ZSegmentedItem value="yearly">Yearly</ZSegmentedItem>
        </ZSegmented>
        <ZStack orientation="horizontal" gap="sm">
          <ZButton type="submit">Submit</ZButton>
          <ZButton type="reset" variant="outline" tone="neutral">
            Reset
          </ZButton>
        </ZStack>
        <p>Submitted: {sent || '—'}</p>
      </ZStack>
    </form>
  );
}

```


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

#### React
```tsx
import { useEffect, useState } from 'react';
import { ZSelect, ZStack } from '@zelviora/react';

/** Shape of the `options` property (ZSelectOptionData of the core package). */
type Plan = { value: string; label: string; description?: string; group?: string; disabled?: boolean };

const PLANS: Plan[] = [
  { 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. */
export function SelectData() {
  const [options, setOptions] = useState<Plan[]>([]);
  const [loading, setLoading] = useState(true);
  useEffect(() => {
    const t = setTimeout(() => { setOptions(PLANS); setLoading(false); }, 1000);
    return () => clearTimeout(t);
  }, []);
  return (
    <ZStack className="demo-narrow">
      <ZSelect label="Plan" options={options} loading={loading} defaultValue="pro" />
      <ZSelect label="Empty list" options={[]} placeholder="No plan available" />
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { useState } from 'react';
import { ZSelect, ZSelectGroup, ZSelectOption, ZStack } from '@zelviora/react';

export function SelectDefault() {
  const [city, setCity] = useState<string | null>('hue');
  return (
    <ZStack className="demo-narrow">
      <ZSelect label="City" hint="Type a letter to jump to a city" clearable value={city} onZChange={(e) => setCity(e.detail.value as string | null)}>
        <ZSelectGroup label="North">
          <ZSelectOption value="hn">Hanoi</ZSelectOption>
          <ZSelectOption value="hp">Hai Phong</ZSelectOption>
        </ZSelectGroup>
        <ZSelectGroup label="Central">
          <ZSelectOption value="hue">Hue</ZSelectOption>
          <ZSelectOption value="dn" disabled>Da Nang</ZSelectOption>
        </ZSelectGroup>
        <ZSelectOption value="hcm" description="Largest city">Ho Chi Minh City</ZSelectOption>
      </ZSelect>
      <span>Selected: {city ?? 'none'}</span>
    </ZStack>
  );
}

```

### Case: form

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZField, ZSelect, ZSelectOption, ZStack } from '@zelviora/react';

/** Native form: required single select inside a field, multiple select with several FormData entries, reset. */
export function SelectForm() {
  const [sent, setSent] = useState('');
  return (
    <form
      className="demo-narrow"
      onSubmit={(e) => {
        e.preventDefault();
        setSent(JSON.stringify([...new FormData(e.currentTarget).entries()]));
      }}
    >
      <ZStack>
        <ZField label="Country" required>
          <ZSelect name="country" required>
            <ZSelectOption value="vn">Vietnam</ZSelectOption>
            <ZSelectOption value="th">Thailand</ZSelectOption>
            <ZSelectOption value="sg">Singapore</ZSelectOption>
          </ZSelect>
        </ZField>
        <ZSelect name="lang" label="Languages" multiple>
          <ZSelectOption value="vi" selected>Vietnamese</ZSelectOption>
          <ZSelectOption value="en" selected>English</ZSelectOption>
          <ZSelectOption value="fr">French</ZSelectOption>
        </ZSelect>
        <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
          <ZButton type="submit">Submit</ZButton>
          <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
        </ZStack>
        {sent && <output>{sent}</output>}
      </ZStack>
    </form>
  );
}

```

### Case: multiple

#### React
```tsx
import { useState } from 'react';
import { ZSelect, ZSelectOption, ZStack } from '@zelviora/react';

const TOPPINGS = ['Cheese', 'Mushroom', 'Olive', 'Onion', 'Pepper', 'Tomato'];

export function SelectMultiple() {
  const [value, setValue] = useState<string[]>(['cheese', 'olive']);
  return (
    <ZStack className="demo-narrow">
      <ZSelect label="Toppings" multiple clearable maxTagCount={2} value={value} onZChange={(e) => setValue(e.detail.value as string[])}>
        {TOPPINGS.map((t) => <ZSelectOption key={t} value={t.toLowerCase()}>{t}</ZSelectOption>)}
      </ZSelect>
      <ZSelect label="Responsive summary" multiple size="sm" variant="filled" value={value} onZChange={(e) => setValue(e.detail.value as string[])}>
        {TOPPINGS.map((t) => <ZSelectOption key={t} value={t.toLowerCase()}>{t}</ZSelectOption>)}
      </ZSelect>
      <span>{value.length ? value.join(', ') : 'Nothing selected'}</span>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZSeparator } from '@zelviora/react';

export function SeparatorBasic() {
  return (
    <div>
      <p>Account settings</p>
      <ZSeparator />
      <p>Notification settings</p>
    </div>
  );
}

```

### Case: label

#### React
```tsx
import { ZSeparator, ZStack } from '@zelviora/react';

export function SeparatorLabel() {
  return (
    <ZStack gap="sm">
      <ZSeparator>OR</ZSeparator>
      <ZSeparator labelPlacement="start" variant="dashed">Details</ZSeparator>
      <ZSeparator labelPlacement="end">More</ZSeparator>
    </ZStack>
  );
}

```

### Case: vertical

#### React
```tsx
import { ZSeparator, ZStack } from '@zelviora/react';

export function SeparatorVertical() {
  return (
    <ZStack orientation="horizontal" alignItems="center" gap="none">
      <span>Edit</span>
      <ZSeparator orientation="vertical" semantic />
      <span>Share</span>
      <ZSeparator orientation="vertical" semantic />
      <span>Delete</span>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZIcon, ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack } from '@zelviora/react';

export function SidebarCollapsible() {
  const [collapsed, setCollapsed] = useState(false);
  return (
    <ZStack orientation="horizontal" className="demo-sidebar-frame">
      <ZSidebar
        label="Main navigation"
        collapsible
        hotkey="Mod+B"
        collapsed={collapsed}
        onZCollapseChange={(e) => {
          // Group events bubble through the sidebar: only the sidebar's own event changes `collapsed`.
          if (e.target === e.currentTarget) setCollapsed(e.detail.collapsed);
        }}
      >
        <ZSidebarGroup label="Workspace">
          <ZSidebarItem href="#sidebar-dashboard" current>
            <ZIcon slot="icon" name="home" />
            Dashboard
          </ZSidebarItem>
          <ZSidebarItem href="#sidebar-orders">
            <ZIcon slot="icon" name="receipt_long" />
            Orders
            <ZBadge slot="end">12</ZBadge>
          </ZSidebarItem>
          <ZSidebarItem id="sidebar-reports">
            <ZIcon slot="icon" name="bar_chart" />
            Reports
            <ZSidebarItem slot="sub" href="#sidebar-sales">Sales</ZSidebarItem>
            <ZSidebarItem slot="sub" href="#sidebar-stock">Stock</ZSidebarItem>
            <ZSidebarItem slot="sub" href="#sidebar-customers">Customers</ZSidebarItem>
          </ZSidebarItem>
        </ZSidebarGroup>
        <ZSidebarGroup label="Settings" collapsible>
          <ZSidebarItem href="#sidebar-team">
            <ZIcon slot="icon" name="person" />
            Team
          </ZSidebarItem>
          <ZSidebarItem href="#sidebar-billing" disabled>
            <ZIcon slot="icon" name="payments" />
            Billing
          </ZSidebarItem>
        </ZSidebarGroup>
      </ZSidebar>
      <p className="demo-grow">Collapsed: {String(collapsed)}. Press Ctrl+B (⌘B on macOS) to toggle.</p>
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { ZBadge, ZIcon, ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack } from '@zelviora/react';

export function SidebarDefault() {
  return (
    <ZStack orientation="horizontal" className="demo-sidebar-frame">
      <ZSidebar label="Main navigation">
        <ZSidebarGroup label="Workspace">
          <ZSidebarItem href="#sidebar-dashboard" current>
            <ZIcon slot="icon" name="home" />
            Dashboard
          </ZSidebarItem>
          <ZSidebarItem href="#sidebar-orders">
            <ZIcon slot="icon" name="receipt_long" />
            Orders
            <ZBadge slot="end">12</ZBadge>
          </ZSidebarItem>
          <ZSidebarItem id="sidebar-reports">
            <ZIcon slot="icon" name="bar_chart" />
            Reports
            <ZSidebarItem slot="sub" href="#sidebar-sales">Sales</ZSidebarItem>
            <ZSidebarItem slot="sub" href="#sidebar-stock">Stock</ZSidebarItem>
            <ZSidebarItem slot="sub" href="#sidebar-customers">Customers</ZSidebarItem>
          </ZSidebarItem>
        </ZSidebarGroup>
        <ZSidebarGroup label="Settings" collapsible>
          <ZSidebarItem href="#sidebar-team">
            <ZIcon slot="icon" name="person" />
            Team
          </ZSidebarItem>
          <ZSidebarItem href="#sidebar-billing" disabled>
            <ZIcon slot="icon" name="payments" />
            Billing
          </ZSidebarItem>
        </ZSidebarGroup>
      </ZSidebar>
      <p className="demo-grow">Page content</p>
    </ZStack>
  );
}

```

### Case: spa-routing

#### React
```tsx
import { useState, type MouseEvent } from 'react';
import { ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack } from '@zelviora/react';

// SPA routing (ADR-026, D-24): item links emit zNavigate (one listener on the sidebar routes them); an item can also
// hold the app's own link (Next.js `Link`, React Router `Link`), which gets aria-current from `current`.
export function SidebarSpaRouting() {
  const [route, setRoute] = useState('#/dashboard');
  const navigate = (e: CustomEvent<{ href: string }>) => {
    e.preventDefault();
    setRoute(e.detail.href); // router.push(e.detail.href)
  };
  const appLink = (e: MouseEvent<HTMLAnchorElement>) => {
    if (e.ctrlKey || e.metaKey || e.shiftKey || e.button !== 0) return;
    e.preventDefault();
    setRoute(e.currentTarget.getAttribute('href')!);
  };
  return (
    <ZStack orientation="horizontal" className="demo-sidebar-frame">
      <ZSidebar label="Main navigation" onZNavigate={navigate}>
        <ZSidebarGroup label="Workspace">
          <ZSidebarItem href="#/dashboard" current={route === '#/dashboard'}>Dashboard</ZSidebarItem>
          <ZSidebarItem href="#/orders" current={route === '#/orders'}>Orders</ZSidebarItem>
          <ZSidebarItem current={route === '#/team'}><a href="#/team" onClick={appLink}>Team</a></ZSidebarItem>
        </ZSidebarGroup>
      </ZSidebar>
      <p aria-live="polite">Current route: <code>{route}</code></p>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZSignature, ZStack } from '@zelviora/react';

/** Draw directly on the High-DPI canvas with guide line, undo, and clear controls. */
export function SignatureDefault() {
  const [value, setValue] = useState('');
  return (
    <ZStack className="demo-narrow">
      <ZSignature
        label="Authorized signature"
        hint="Sign using mouse, trackpad, or stylus"
        showGuide
        value={value}
        onZChange={(e) => setValue(e.detail.value)}
      />
      <span>Status: {value ? `Signed (${value.length} chars)` : 'Empty'}</span>
    </ZStack>
  );
}

```

### Case: form

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZField, ZSignature, ZStack } from '@zelviora/react';

/** Required signature inside a native form with FormData submission and reset. */
export function SignatureForm() {
  const [sent, setSent] = useState('');
  return (
    <form
      className="demo-narrow"
      onSubmit={(e) => {
        e.preventDefault();
        const data = new FormData(e.currentTarget);
        const sig = String(data.get('approvalSignature') ?? '');
        setSent(sig ? `Submitted (${sig.slice(0, 32)}...)` : 'No signature submitted');
      }}
    >
      <ZStack>
        <ZField label="Approval signature" hint="Required before submitting contract" required>
          <ZSignature name="approvalSignature" showGuide required />
        </ZField>
        <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
          <ZButton type="submit">Submit</ZButton>
          <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
        </ZStack>
        {sent && <output>{sent}</output>}
      </ZStack>
    </form>
  );
}

```

### Case: states

#### React
```tsx
import { ZSignature, ZStack } from '@zelviora/react';

/** Disabled, readonly, contextual status, and invalid signature pads. */
export function SignatureStates() {
  return (
    <ZStack className="demo-narrow">
      <ZSignature label="Disabled" disabled showGuide />
      <ZSignature label="Readonly" readonly showGuide />
      <ZSignature label="Warning status" status="warning" hint="Signature differs from file record" />
      <ZSignature label="Invalid" invalid hint="Please provide your signature" />
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZSignature, ZStack } from '@zelviora/react';

/** Outline, filled, and borderless visual variants across small, medium, and large sizes. */
export function SignatureVariants() {
  return (
    <ZStack className="demo-narrow">
      <ZSignature label="Outline (small)" variant="outline" size="sm" showGuide />
      <ZSignature label="Filled (medium)" variant="filled" size="md" showGuide />
      <ZSignature label="Borderless (large)" variant="borderless" size="lg" showGuide />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZSkeleton } from '@zelviora/react';

export function SkeletonBasic() {
  return <ZSkeleton width="200px" height="20px" />;
}

```

### Case: loading

#### React
```tsx
import { useEffect, useState } from 'react';
import { ZButton, ZSkeleton, ZStack } from '@zelviora/react';

export function SkeletonLoading() {
  const [loaded, setLoaded] = useState(false);
  const [run, setRun] = useState(0);
  useEffect(() => {
    setLoaded(false);
    const id = setTimeout(() => setLoaded(true), 2000);
    return () => clearTimeout(id);
  }, [run]);
  return (
    <ZStack gap="sm" alignItems="start">
      <section aria-busy={!loaded} className="demo-narrow">
        {loaded ? <p>Your report for September is ready: revenue grew 12% compared with August.</p> : <ZSkeleton shape="text" lines={2} />}
      </section>
      <ZButton variant="outline" size="sm" disabled={!loaded} onClick={() => setRun((n) => n + 1)}>Reload</ZButton>
    </ZStack>
  );
}

```

### Case: shapes

#### React
```tsx
import { ZSkeleton, ZStack } from '@zelviora/react';

export function SkeletonShapes() {
  return (
    <ZStack orientation="horizontal" gap="md" alignItems="start" aria-busy="true" className="demo-narrow">
      <ZSkeleton shape="circle" width="40px" />
      {/* demo-grow: the text column takes the rest of the row. */}
      <ZStack gap="sm" className="demo-grow">
        <ZSkeleton shape="text" width="50%" />
        <ZSkeleton shape="text" lines={3} />
      </ZStack>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZNumberInput, ZSlider, ZStack } from '@zelviora/react';

/** One React state shared by a slider and a number-input (both directions). */
export function SliderControlled() {
  const [value, setValue] = useState(25);
  return (
    <ZStack className="demo-narrow">
      <ZSlider label="Budget share" value={value} onZInput={(e) => setValue(e.detail.value)} />
      <ZNumberInput label="Budget share (exact)" min={0} max={100} value={value} onZInput={(e) => setValue(e.detail.value ?? 0)} />
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { ZSlider, ZStack } from '@zelviora/react';

/** A 0–100 slider with a hint; the value bubble shows while dragging or focused. */
export function SliderDefault() {
  return (
    <ZStack className="demo-narrow">
      <ZSlider label="Volume" name="volume" defaultValue={40} hint="Speaker volume" />
      <ZSlider label="Brightness" defaultValue={70} showValue="always" size="lg" />
      <ZSlider label="Locked" defaultValue={20} disabled />
    </ZStack>
  );
}

```

### Case: form

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZSlider, ZStack } from '@zelviora/react';

const usd = (v: number, locale: string) => new Intl.NumberFormat(locale, { style: 'currency', currency: 'USD', maximumFractionDigits: 0 }).format(v);

/** The form gets the canonical number; formatValue only changes the bubble and aria-valuetext. */
export function SliderForm() {
  const [sent, setSent] = useState('');
  return (
    <form
      className="demo-narrow"
     
      onSubmit={(e) => {
        e.preventDefault();
        setSent(JSON.stringify([...new FormData(e.currentTarget).entries()]));
      }}
    >
      <ZStack>
        <ZSlider label="Budget" name="budget" min={0} max={1000} step={50} defaultValue={300} formatValue={usd} showValue="always" />
        <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
          <ZButton type="submit">Submit</ZButton>
          <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
        </ZStack>
        {sent && <output>{sent}</output>}
      </ZStack>
    </form>
  );
}

```

### Case: i18n

#### React
```tsx
import { ZSlider } from '@zelviora/react';

const vnd = (v: number, locale: string) => new Intl.NumberFormat(locale, { style: 'currency', currency: 'VND' }).format(v);

/** `lang="vi"`: formatValue formats the bubble and aria-valuetext as VND. */
export function SliderI18n() {
  return (
    <div className="demo-narrow" lang="vi">
      <ZSlider label="Ngân sách" min={0} max={1000000} step={50000} defaultValue={300000} formatValue={vnd} showValue="always" />
    </div>
  );
}

```

### Case: marks

#### React
```tsx
import { ZSlider, ZStack } from '@zelviora/react';

const marks = [0, 25, 50, 75, 100].map((value) => ({ value, label: `${value}%` }));

/** Marks with labels and snapping to them; `marks` true draws one tick per step. */
export function SliderMarks() {
  return (
    <ZStack className="demo-narrow">
      <ZSlider label="Zoom" marks={marks} snapToMarks defaultValue={50} />
      <ZSlider label="Rating" min={0} max={10} marks defaultValue={6} />
    </ZStack>
  );
}

```

### Case: vertical

#### React
```tsx
import { ZSlider, ZStack } from '@zelviora/react';

/** Vertical sliders: ArrowUp/ArrowRight increase, the bottom is the minimum. */
export function SliderVertical() {
  return (
    <ZStack orientation="horizontal" gap="lg">
      <ZSlider label="Bass" orientation="vertical" defaultValue={30} />
      <ZSlider label="Treble" orientation="vertical" defaultValue={60} />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZCard, ZSpinner, ZStack } from '@zelviora/react';

/** The card announces loading itself (`aria-busy` and visible text), so the spinner is hidden from assistive technology. */
export function SpinnerDecorative() {
  return (
    <ZCard heading="Orders" aria-busy="true" className="demo-narrow">
      <ZStack orientation="horizontal" alignItems="center" gap="sm">
        <ZSpinner decorative size="sm" />
        <span>Loading orders…</span>
      </ZStack>
    </ZCard>
  );
}

```

### Case: default

#### React
```tsx
import { ZSpinner } from '@zelviora/react';

export function SpinnerDefault() {
  return <ZSpinner />;
}

```

### Case: delay

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZSpinner, ZStack } from '@zelviora/react';

/** Loading driven from outside; with `delay` the spinner only appears when loading lasts longer than 300 ms. */
export function SpinnerDelay() {
  const [fast, setFast] = useState(false);
  const [slow, setSlow] = useState(false);
  const run = (set: (v: boolean) => void, ms: number) => {
    set(true);
    setTimeout(() => set(false), ms);
  };
  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" alignItems="center" gap="md" wrap>
        <ZButton variant="outline" tone="neutral" onClick={() => run(setFast, 200)}>Fast load (200 ms)</ZButton>
        {fast && <ZSpinner delay={300} showLabel />}
      </ZStack>
      <ZStack orientation="horizontal" alignItems="center" gap="md" wrap>
        <ZButton variant="outline" tone="neutral" onClick={() => run(setSlow, 2000)}>Slow load (2 s)</ZButton>
        {slow && <ZSpinner delay={300} showLabel />}
      </ZStack>
    </ZStack>
  );
}

```

### Case: label

#### React
```tsx
import { ZSpinner, ZStack } from '@zelviora/react';

/** The label is the accessible name; `showLabel` also shows it next to the spinner. */
export function SpinnerLabel() {
  return (
    <ZStack gap="md">
      <ZSpinner showLabel />
      <ZSpinner showLabel tone="primary" label="Loading the order list" />
      <ZSpinner showLabel size="sm" label="Synchronizing the quarterly revenue report of every branch, this can take a few minutes" />
    </ZStack>
  );
}

```

### Case: sizes

#### React
```tsx
import { ZSpinner, ZStack } from '@zelviora/react';

const sizes = ['xs', 'sm', 'md', 'lg', 'xl'] as const;

export function SpinnerSizes() {
  return (
    <ZStack orientation="horizontal" alignItems="center" gap="lg" wrap>
      {sizes.map((size) => (
        <ZSpinner key={size} size={size} label={`Loading (${size})`} />
      ))}
    </ZStack>
  );
}

```

### Case: tones

#### React
```tsx
import { ZSpinner, ZStack } from '@zelviora/react';

const tones = ['neutral', 'primary', 'success', 'warning', 'destructive', 'info'] as const;

/** `current` (default) takes the surrounding text color; the other tones use their semantic color. */
export function SpinnerTones() {
  return (
    <ZStack orientation="horizontal" alignItems="center" gap="lg" wrap>
      <span className="demo-text-destructive">
        <ZSpinner size="lg" label="Loading (current color)" />
      </span>
      {tones.map((tone) => (
        <ZSpinner key={tone} size="lg" tone={tone} label={`Loading (${tone})`} />
      ))}
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZCard, ZSplitter, ZSplitterHandle, ZSplitterPanel, ZStack, ZText } from '@zelviora/react';
import { collapsedLog, collapsibleSplit } from '../data.ts';

export function SplitterCollapsible() {
  const { handleLabel, withGrip, panes: [nav, files] } = collapsibleSplit;
  const [collapsed, setCollapsed] = useState(false);
  return (
    <ZStack gap="sm">
      <ZSplitter className="demo-splitter-frame" onZCollapseChange={(e) => setCollapsed(e.detail.collapsed)}>
        <ZSplitterPanel id={nav.id} defaultSize={nav.defaultSize} minSize={nav.minSize} maxSize={nav.maxSize} collapsible={nav.collapsible}>
          <ZCard variant="ghost" heading={nav.heading}>
            <ZText variant={nav.variant}>{nav.text}</ZText>
          </ZCard>
        </ZSplitterPanel>
        <ZSplitterHandle label={handleLabel} withGrip={withGrip} />
        <ZSplitterPanel>
          <ZCard variant="ghost" heading={files.heading}>
            <ZText variant={files.variant}>{files.text}</ZText>
          </ZCard>
        </ZSplitterPanel>
      </ZSplitter>
      <ZText variant="muted" size="sm">{collapsedLog(collapsed)}</ZText>
    </ZStack>
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZCard, ZSplitter, ZSplitterHandle, ZSplitterPanel, ZStack, ZText } from '@zelviora/react';
import { controlledInitial, controlledLog, controlledPresets, controlledSplit } from '../data.ts';

export function SplitterControlled() {
  const { handleLabel, panes: [original, revised] } = controlledSplit;
  const [value, setValue] = useState<number[]>(controlledInitial);
  const [committed, setCommitted] = useState<number[]>(controlledInitial);
  return (
    <ZStack gap="sm">
      <ZStack orientation="horizontal" gap="sm" wrap>
        {controlledPresets.map((p) => (
          <ZButton key={p.label} size="sm" variant="outline" tone="neutral" onClick={() => setValue(p.value)}>{p.label}</ZButton>
        ))}
      </ZStack>
      <ZSplitter
        className="demo-splitter-frame"
        value={value}
        onZInput={(e) => setValue(e.detail.value)}
        onZChange={(e) => setCommitted(e.detail.value)}
      >
        <ZSplitterPanel minSize={original.minSize}>
          <ZCard variant="ghost" heading={original.heading} />
        </ZSplitterPanel>
        <ZSplitterHandle label={handleLabel} />
        <ZSplitterPanel minSize={revised.minSize}>
          <ZCard variant="ghost" heading={revised.heading} />
        </ZSplitterPanel>
      </ZSplitter>
      <ZText variant="muted" size="sm">{controlledLog(value, committed)}</ZText>
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { ZCard, ZSplitter, ZSplitterHandle, ZSplitterPanel, ZText } from '@zelviora/react';
import { defaultSplit } from '../data.ts';

export function SplitterDefault() {
  const { handleLabel, panes: [list, message] } = defaultSplit;
  return (
    <ZSplitter className="demo-splitter-frame">
      <ZSplitterPanel id={list.id} defaultSize={list.defaultSize} minSize={list.minSize}>
        <ZCard variant="ghost" heading={list.heading}>
          <ZText variant={list.variant}>{list.text}</ZText>
        </ZCard>
      </ZSplitterPanel>
      <ZSplitterHandle label={handleLabel} />
      <ZSplitterPanel minSize={message.minSize}>
        <ZCard variant="ghost" heading={message.heading}>
          <ZText variant={message.variant}>{message.text}</ZText>
        </ZCard>
      </ZSplitterPanel>
    </ZSplitter>
  );
}

```

### Case: nested

#### React
```tsx
import { ZCard, ZSplitter, ZSplitterHandle, ZSplitterPanel, ZText } from '@zelviora/react';
import { nestedInner, nestedOuter, nestedPersistKey } from '../data.ts';

/** IDE layout: a file tree, then an editor above a terminal. The sizes persist in localStorage (`persistKey`, by panel id). */
export function SplitterNested() {
  const { panes: [files, main] } = nestedOuter;
  const { panes: [editor, terminal] } = nestedInner;
  return (
    <ZSplitter className="demo-splitter-frame" persistKey={nestedPersistKey}>
      <ZSplitterPanel id={files.id} defaultSize={files.defaultSize} minSize={files.minSize}>
        <ZCard variant="ghost" heading={files.heading}>
          <ZText variant={files.variant}>{files.text}</ZText>
        </ZCard>
      </ZSplitterPanel>
      <ZSplitterHandle label={nestedOuter.handleLabel} />
      <ZSplitterPanel id={main.id}>
        <ZSplitter orientation="vertical" className="demo-fill">
          <ZSplitterPanel defaultSize={editor.defaultSize}>
            <ZCard variant="ghost" heading={editor.heading}>
              <ZText variant={editor.variant}>{editor.text}</ZText>
            </ZCard>
          </ZSplitterPanel>
          <ZSplitterHandle label={nestedInner.handleLabel} withGrip={nestedInner.withGrip} />
          <ZSplitterPanel collapsible={terminal.collapsible}>
            <ZCard variant="ghost" heading={terminal.heading}>
              <ZText variant={terminal.variant}>{terminal.text}</ZText>
            </ZCard>
          </ZSplitterPanel>
        </ZSplitter>
      </ZSplitterPanel>
    </ZSplitter>
  );
}

```

### Case: vertical

#### React
```tsx
import { ZCard, ZSplitter, ZSplitterHandle, ZSplitterPanel, ZText } from '@zelviora/react';
import { verticalSplit } from '../data.ts';

export function SplitterVertical() {
  const { handleLabel, withGrip, panes: [editor, terminal] } = verticalSplit;
  return (
    <ZSplitter orientation="vertical" className="demo-splitter-frame">
      <ZSplitterPanel defaultSize={editor.defaultSize} minSize={editor.minSize}>
        <ZCard variant="ghost" heading={editor.heading}>
          <ZText variant={editor.variant}>{editor.text}</ZText>
        </ZCard>
      </ZSplitterPanel>
      <ZSplitterHandle label={handleLabel} withGrip={withGrip} />
      <ZSplitterPanel minSize={terminal.minSize}>
        <ZCard variant="ghost" heading={terminal.heading}>
          <ZText variant={terminal.variant}>{terminal.text}</ZText>
        </ZCard>
      </ZSplitterPanel>
    </ZSplitter>
  );
}

```


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

#### React
```tsx
import { ZCard, ZStack } from '@zelviora/react';

export function StackBasic() {
  return (
    <ZStack>
      <ZCard heading="Profile">Name, avatar and bio.</ZCard>
      <ZCard heading="Security">Password and two-step sign-in.</ZCard>
      <ZCard heading="Notifications">Email and push preferences.</ZCard>
    </ZStack>
  );
}

```

### Case: composition

#### React
```tsx
import { ZButton, ZCard, ZStack } from '@zelviora/react';

/** Dialog-style footer: actions pushed to the inline end (the right in LTR, the left in RTL). */
export function StackComposition() {
  return (
    <ZCard heading="Delete project?" description="This removes 12 files and cannot be undone.">
      <ZStack slot="footer" orientation="horizontal" justify="end" gap="sm" wrap>
        <ZButton variant="ghost" tone="neutral">Cancel</ZButton>
        <ZButton tone="destructive">Delete</ZButton>
      </ZStack>
    </ZCard>
  );
}

```

### Case: divider

#### React
```tsx
import { ZLink, ZStack } from '@zelviora/react';

export function StackDivider() {
  return (
    <ZStack gap="lg">
      <ZStack divider gap="sm">
        <span>Order placed</span>
        <span>Payment confirmed</span>
        <span>Shipped</span>
      </ZStack>
      <nav aria-label="Legal">
        <ZStack orientation="horizontal" divider gap="md">
          <ZLink href="#privacy" tone="neutral">Privacy</ZLink>
          <ZLink href="#terms" tone="neutral">Terms</ZLink>
          <ZLink href="#cookies" tone="neutral">Cookies</ZLink>
        </ZStack>
      </nav>
    </ZStack>
  );
}

```

### Case: gaps

#### React
```tsx
import { ZBadge, ZStack } from '@zelviora/react';

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. */
export function StackGaps() {
  return (
    <ZStack gap="md">
      {gaps.map((gap) => (
        <ZStack key={gap} orientation="horizontal" gap={gap}>
          <ZBadge variant="solid">gap="{gap}"</ZBadge>
          <ZBadge variant="solid">B</ZBadge>
          <ZBadge variant="solid">C</ZBadge>
        </ZStack>
      ))}
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZBadge, ZButton, ZStack } from '@zelviora/react';

const tags = ['design', 'tokens', 'react', 'vue', 'angular', 'accessibility', 'i18n', 'rtl', 'density', 'themes'];

export function StackVariants() {
  return (
    <ZStack gap="lg">
      <ZStack orientation="horizontal" alignItems="center" gap="sm">
        <ZButton>Row</ZButton>
        <ZButton variant="outline" tone="neutral">alignItems="center"</ZButton>
      </ZStack>
      <ZStack orientation="horizontal" wrap gap="xs">
        {tags.map((tag) => (
          <ZBadge key={tag}>{tag}</ZBadge>
        ))}
      </ZStack>
      <p>
        Inline stack inside text:{' '}
        <ZStack inline orientation="horizontal" gap="xs">
          <ZBadge tone="success">paid</ZBadge>
          <ZBadge tone="info">shipped</ZBadge>
        </ZStack>
      </p>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZStatistic } from '@zelviora/react';

export function StatisticBasic() {
  return <ZStatistic label="Active users" value={112893} />;
}

```

### Case: countdown

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZStack, ZStatistic } from '@zelviora/react';

const inSeconds = (s: number) => Date.now() + s * 1000;

export function StatisticCountdown() {
  const [sale] = useState(() => inSeconds(2 * 3600 + 15 * 60));
  const [quiz, setQuiz] = useState(() => inSeconds(10));
  const [done, setDone] = useState(false);
  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" wrap gap="lg">
        <ZStatistic label="Flash sale ends in" countdownTo={sale} />
        <ZStatistic label="Quiz" countdownTo={quiz} onZFinish={() => setDone(true)} />
      </ZStack>
      <ZStack orientation="horizontal" alignItems="center" gap="sm">
        <ZButton variant="outline" tone="neutral" onClick={() => { setDone(false); setQuiz(inSeconds(10)); }}>Restart quiz</ZButton>
        <span>{done ? 'Time is up' : 'Running'}</span>
      </ZStack>
    </ZStack>
  );
}

```

### Case: dashboard

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZCard, ZGrid, ZStack, ZStatistic } from '@zelviora/react';

export function StatisticDashboard() {
  const [visits, setVisits] = useState(8240);
  return (
    <ZStack gap="md">
      <ZGrid columns="1 sm:3" gap="md">
        <ZCard>
          <ZStatistic label="Visits today" value={visits} trend="up" delta={0.052} />
        </ZCard>
        <ZCard>
          <ZStatistic label="Average order" value={36.4} currency="EUR" trend="down" delta={-0.012} />
        </ZCard>
        <ZCard>
          <ZStatistic label="Downloads" value={98}>
            <span slot="suffix">/ 120</span>
          </ZStatistic>
        </ZCard>
      </ZGrid>
      <ZStack orientation="horizontal">
        <ZButton variant="outline" tone="neutral" onClick={() => setVisits((v) => v + 37)}>Refresh</ZButton>
      </ZStack>
    </ZStack>
  );
}

```

### Case: formats

#### React
```tsx
import { ZGrid, ZStatistic } from '@zelviora/react';

export function StatisticFormats() {
  return (
    <ZGrid columns="1 sm:2 md:4" gap="md">
      <ZStatistic label="Revenue" value={1234567890} currency="USD" />
      <ZStatistic label="Conversion" value={0.0342} format={{ style: 'percent', maximumFractionDigits: 1 }} />
      <ZStatistic label="Page views" value={1250000} format={{ notation: 'compact' }} />
      <ZStatistic label="Storage" value={42.5} format={{ style: 'unit', unit: 'gigabyte' }} />
    </ZGrid>
  );
}

```

### Case: i18n

#### React
```tsx
import { ZGrid, ZStatistic } from '@zelviora/react';

export function StatisticI18n() {
  return (
    <ZGrid columns="1 sm:2" gap="md">
      <ZStatistic label="Doanh thu" value={1234567890} currency="VND" locale="vi" />
      <ZStatistic label="Tỷ lệ chuyển đổi" value={0.0342} format={{ style: 'percent', maximumFractionDigits: 1 }} locale="vi" />
    </ZGrid>
  );
}

```

### Case: sizes

#### React
```tsx
import { ZStack, ZStatistic } from '@zelviora/react';

const sizes = ['sm', 'md', 'lg'] as const;

export function StatisticSizes() {
  return (
    <ZStack orientation="horizontal" wrap gap="lg">
      {sizes.map((size) => (
        <ZStatistic key={size} size={size} label={`Size ${size}`} value={2048} />
      ))}
    </ZStack>
  );
}

```

### Case: states

#### React
```tsx
import { ZStack, ZStatistic } from '@zelviora/react';

export function StatisticStates() {
  return (
    <ZStack orientation="horizontal" wrap gap="lg">
      <ZStatistic label="Loading" value={100} loading />
      <ZStatistic label="Invalid value" value={Number.NaN} />
      <ZStatistic label="Text value" value="N/A" />
    </ZStack>
  );
}

```

### Case: trends

#### React
```tsx
import { ZGrid, ZStatistic } from '@zelviora/react';

export function StatisticTrends() {
  return (
    <ZGrid columns="1 sm:2 md:4" gap="md">
      <ZStatistic label="Revenue" value={48200} currency="USD" trend="up" delta={0.124} />
      <ZStatistic label="Orders" value={1320} trend="down" delta={-0.031} />
      <ZStatistic label="Costs" value={9100} currency="USD" trend="up" trendSentiment="negative" delta={0.08} />
      <ZStatistic label="Refunds" value={12} trend="neutral" delta={0} />
    </ZGrid>
  );
}

```


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

#### React
```tsx
import { ZStep, ZSteps } from '@zelviora/react';

export function StepsDefault() {
  return (
    <ZSteps defaultCurrent={1} label="Checkout progress">
      <ZStep>Cart</ZStep>
      <ZStep description="Address and method">Shipping</ZStep>
      <ZStep>Payment</ZStep>
    </ZSteps>
  );
}

```

### Case: navigable

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZStack, ZStep, ZSteps } from '@zelviora/react';

const titles = ['Account', 'Profile', 'Preferences', 'Review'];

export function StepsNavigable() {
  const [current, setCurrent] = useState(0);
  return (
    <ZStack gap="md">
      <ZSteps current={current} navigable linear label="Sign-up progress" onZChange={(e) => setCurrent(e.detail.current)}>
        {titles.map((t) => (
          <ZStep key={t}>{t}</ZStep>
        ))}
      </ZSteps>
      <p>Step {current + 1}: {titles[current]}</p>
      <ZStack orientation="horizontal" gap="sm">
        <ZButton variant="outline" tone="neutral" disabled={current === 0} onClick={() => setCurrent(current - 1)}>
          Back
        </ZButton>
        <ZButton disabled={current === titles.length - 1} onClick={() => setCurrent(current + 1)}>
          Next
        </ZButton>
      </ZStack>
    </ZStack>
  );
}

```

### Case: vertical

#### React
```tsx
import { ZStep, ZSteps } from '@zelviora/react';

export function StepsVertical() {
  return (
    <ZSteps defaultCurrent={2} orientation="vertical" size="sm" label="Deployment">
      <ZStep description="Commit 4f2a9c1">Build</ZStep>
      <ZStep description="212 tests passed">Test</ZStep>
      <ZStep status="error" description="Health check timed out">
        Deploy
      </ZStep>
      <ZStep>Verify</ZStep>
    </ZSteps>
  );
}

```


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

#### React
```tsx
import { ZSunburstChart } from '@zelviora/react-chart';
import { storageTree, storageSeries } from '../data.ts';

export function SunburstChartBasic() {
  return (
    <ZSunburstChart
      heading="Cloud Storage Partition by Region and Tier (TB)"
      description="Concentric rings break down total storage across geographic regions and storage classes."
      treeData={storageTree} series={storageSeries}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/react';
import { ZSunburstChart } from '@zelviora/react-chart';
import { storageTree, storageSeries } from '../data.ts';

export function SunburstChartControlled() {
  const [hidden, setHidden] = useState<string[]>([]);
  const [selected, setSelected] = useState<string>('Click any chart element to inspect');

  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <ZButton
          size="sm"
          variant="outline"
          onClick={() => setHidden([])}
        >
          Show All Series
        </ZButton>
        <ZBadge tone="primary" variant="soft">
          {selected}
        </ZBadge>
        <ZText variant="muted" size="sm">
          Hidden: {hidden.length ? hidden.join(', ') : 'none'}
        </ZText>
      </ZStack>
      <ZSunburstChart
        heading="Cloud Storage Partition by Region and Tier (TB) (Interactive)"
        description="Concentric rings break down total storage across geographic regions and storage classes."
        treeData={storageTree} series={storageSeries}
        selectable
        hiddenSeries={hidden}
        onZSeriesToggle={(e) => setHidden(e.detail.hiddenSeries)}
        onZPointSelect={(e) =>
          setSelected(`Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`)
        }
      />
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZSunburstChart } from '@zelviora/react-chart';
import { storageTree, storageSeries } from '../data.ts';

export function SunburstChartCustomization() {
  return (
    <ZSunburstChart
      className="demo-chart-brand"
      description="Concentric rings break down total storage across geographic regions and storage classes."
      valueFormat={{ maximumFractionDigits: 1 }}
      treeData={storageTree} series={storageSeries} innerRadius="22%" outerRadius="88%" renderer="canvas"
    >
      <span slot="heading">Cloud Storage Partition by Region and Tier (TB) — Custom Theme Tokens &amp; Canvas</span>
    </ZSunburstChart>
  );
}

```

### Case: states

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZSunburstChart } from '@zelviora/react-chart';
import { storageTree, storageSeries } from '../data.ts';

export function SunburstChartStates() {
  return (
    <ZStack gap="lg">
      <ZSunburstChart
        heading="Loading State (aria-busy)"
        loading
        treeData={storageTree} series={storageSeries}
      />
      <ZSunburstChart
        heading="Empty State"
        treeData={[]}
        series={storageSeries}
      />
      <ZSunburstChart
        heading="Expanded Accessible Data Table"
        description="Concentric rings break down total storage across geographic regions and storage classes."
        showDataTable
        treeData={storageTree} series={storageSeries}
      />
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZSunburstChart } from '@zelviora/react-chart';
import { storageTree, storageSeries } from '../data.ts';

export function SunburstChartVariants() {
  return (
    <ZStack gap="lg">
      <ZSunburstChart
        heading="Hollow Core Sunburst"
        description="Hollow center ring (28%–86%) vs full-center sunburst without sector labels."
        treeData={storageTree} series={storageSeries} innerRadius="28%" outerRadius="86%"
      />
      <ZSunburstChart
        heading="Solid Center Sunburst"
        description="Hollow center ring (28%–86%) vs full-center sunburst without sector labels."
        treeData={storageTree} series={storageSeries} innerRadius="0%" outerRadius="78%" showLabel={false}
      />
    </ZStack>
  );
}

```


================================================================================
# COMPONENT: SVG
================================================================================

## Documentation

# SVG Angular Demos

Demo cases for `<z-svg>` in Angular.


## Examples & Implementation

### Case: basic

#### React
```tsx
import { ZSvg, ZStack } from '@zelviora/react';

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>`;

export function SvgBasic() {
  return (
    <ZStack orientation="horizontal" gap="lg" alignItems="center">
      <ZSvg src={SAMPLE_SVG} imageTitle="Default size SVG" />
      <ZSvg src={SAMPLE_SVG} imageTitle="Medium size SVG" size="32px" color="var(--z-color-primary)" />
      <ZSvg src={SAMPLE_SVG} imageTitle="Large size SVG" size="48px" color="var(--z-color-success)" />
    </ZStack>
  );
}

```

### Case: preview

#### React
```tsx
import { ZSvg, ZStack, ZText } from '@zelviora/react';

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>`;

export function SvgPreview() {
  return (
    <ZStack gap="sm">
      <ZText variant="muted" size="sm">
        Click the SVG graphic below to open full-screen lightbox preview:
      </ZText>
      <ZSvg
        src={DETAILED_SVG}
        imageTitle="Verified badge"
        preview
        size="64px"
      />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZSwitch, ZStack } from '@zelviora/react';

export function SwitchDefault() {
  const [on, setOn] = useState(false);
  return (
    <ZStack gap="sm">
      <ZSwitch name="notify" checked={on} onZChange={(e) => setOn(e.detail.checked)}>Email notifications</ZSwitch>
      <p>Notifications are {on ? 'on' : 'off'}.</p>
    </ZStack>
  );
}

```

### Case: form

#### React
```tsx
import { useState, type FormEvent } from 'react';
import { ZButton, ZSwitch, ZStack } from '@zelviora/react';

export function SwitchForm() {
  const [sent, setSent] = useState('');
  const submit = (e: FormEvent<HTMLFormElement>) => {
    e.preventDefault();
    setSent(JSON.stringify(Object.fromEntries(new FormData(e.currentTarget))));
  };
  return (
    <form onSubmit={submit}>
      <ZStack>
      <ZSwitch name="terms" value="accepted" required>Accept the terms</ZSwitch>
      <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
        <ZButton type="submit">Submit</ZButton>
        <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
      </ZStack>
      <p>FormData: {sent || '(not submitted)'}</p>
      </ZStack>
    </form>
  );
}

```

### Case: states

#### React
```tsx
import { ZSwitch, ZStack } from '@zelviora/react';

export function SwitchStates() {
  return (
    <ZStack gap="sm">
      <ZSwitch size="sm">Small</ZSwitch>
      <ZSwitch defaultChecked>Medium, on</ZSwitch>
      <ZSwitch size="lg" hint="Sent every Monday.">Large with a hint</ZSwitch>
      <ZSwitch disabled defaultChecked>Disabled</ZSwitch>
      <ZSwitch readonly defaultChecked>Read-only</ZSwitch>
      <ZSwitch label-placement="start">Label before the switch</ZSwitch>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZStack, ZTable } from '@zelviora/react';

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 },
];

export function TableAppearance() {
  return (
    <ZStack gap="lg">
      <ZTable caption="Small, striped" size="sm" striped columns={columns} rows={rows} />
      <ZTable caption="Medium, bordered" bordered columns={columns} rows={rows} />
      <ZTable caption="Large, striped and bordered" size="lg" striped bordered columns={columns} rows={rows} />
    </ZStack>
  );
}

```

### Case: basic

#### React
```tsx
import { ZTable } from '@zelviora/react';

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 },
];

export function TableBasic() {
  return <ZTable caption="Users" rowHeader="name" columns={columns} rows={rows} />;
}

```

### Case: conditional

#### React
```tsx
import { ZTable } from '@zelviora/react';

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

export function TableConditional() {
  return (
    <ZTable
      className="demo-table-invoices"
      caption="Invoices"
      columns={columns}
      rows={rows}
      rowParts={(r: Invoice) => (r.overdue ? ['overdue'] : [])}
      cellParts={(r: Invoice, col: string) => (col === 'balance' && r.balance < 0 ? ['negative'] : [])}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useMemo, useState } from 'react';
import { ZStack, ZTable } from '@zelviora/react';

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 },
];

/** `processing="manual"`: the table only reports the sort; the app orders the rows (as a server would). */
export function TableControlled() {
  const [sort, setSort] = useState<Array<{ key: string; direction: 'ascending' | 'descending' }>>([{ key: 'population', direction: 'descending' }]);
  const rows = useMemo(() => {
    const s = 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)));
    });
  }, [sort]);
  return (
    <ZStack gap="sm">
      <ZTable caption="Cities" processing="manual" sort={sort} columns={columns} rows={rows} onZSortChange={(e) => setSort(e.detail.sort)} />
      <p>Current sort: {sort[0] ? `${sort[0].key} ${sort[0].direction}` : 'none'}</p>
    </ZStack>
  );
}

```

### Case: footer

#### React
```tsx
import { ZTable } from '@zelviora/react';

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 },
];

export function TableFooter() {
  const total = rows.reduce((s, r) => s + r.amount, 0);
  return (
    <ZTable caption="Monthly costs" hideCaption rowHeader="item" columns={columns} rows={rows}>
      <strong slot="footer">Total: {new Intl.NumberFormat('en', { style: 'currency', currency: 'USD' }).format(total)}</strong>
    </ZTable>
  );
}

```

### Case: formatting

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZStack, ZTable } from '@zelviora/react';

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'] },
];

export function TableFormatting() {
  const [lang, setLang] = useState<'en' | 'de'>('en');
  return (
    <ZStack lang={lang} gap="sm" alignItems="start">
      <ZButton variant="outline" tone="neutral" onClick={() => setLang(lang === 'de' ? 'en' : 'de')}>
        Switch to {lang === 'de' ? 'English' : 'German'}
      </ZButton>
      <ZTable caption="Orders" columns={columns} rows={rows} />
    </ZStack>
  );
}

```

### Case: grouped

#### React
```tsx
import { ZTable } from '@zelviora/react';

// 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' },
];

export function TableGrouped() {
  return <ZTable caption="Staff" rowHeader="general.name" columns={columns} rows={rows} />;
}

```

### Case: pinned

#### React
```tsx
import { ZButton, ZContainer, ZTable } from '@zelviora/react';

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])),
}));

export function TablePinned() {
  return (
    // A 40rem frame, narrower than the 14 columns: the table scrolls inline with pinned edges.
    <ZContainer size="sm" padding="none">
      <ZTable caption="Monthly sales" columns={columns} rows={rows} stickyHeader maxHeight="16rem">
        {rows.map((r) => (
          <ZButton key={r.key} slot={`cell:${r.key}:actions`} size="sm" variant="ghost">
            Edit
          </ZButton>
        ))}
      </ZTable>
    </ZContainer>
  );
}

```

### Case: states

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZStack, ZTable } from '@zelviora/react';

const columns = [
  { key: 'name', header: 'Name' },
  { key: 'status', header: 'Status' },
];

const data = [
  { key: 'a', name: 'Backup', status: 'Done' },
  { key: 'b', name: 'Import', status: 'Running' },
];

export function TableStates() {
  const [loading, setLoading] = useState(false);
  return (
    <ZStack gap="lg">
      <ZTable caption="Loading without rows" loading columns={columns} rows={[]} />
      <ZTable caption="Empty" columns={columns} rows={[]} emptyText="No jobs yet" />
      <ZStack gap="sm" alignItems="start">
        <ZButton variant="outline" tone="neutral" onClick={() => setLoading((v) => !v)}>
          {loading ? 'Stop loading' : 'Reload'}
        </ZButton>
        <ZTable caption="Loading with rows (rows are dimmed)" loading={loading} columns={columns} rows={data} />
      </ZStack>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZTabs, ZTabsList, ZTabsPanel, ZTabsTrigger } from '@zelviora/react';

let next = 4;

export function TabsClosable() {
  const [tabs, setTabs] = useState(['1', '2', '3']);
  const [value, setValue] = useState('1');
  const add = () => {
    const id = String(next++);
    setTabs((t) => [...t, id]);
    setValue(id);
  };
  return (
    <ZTabs
      value={value}
      overflow="menu"
      onZChange={(e) => setValue(e.detail.value)}
      onZClose={(e) => setTabs((t) => t.filter((id) => id !== e.detail.value))}
    >
      <ZButton slot="end" variant="ghost" tone="neutral" size="sm" label="Add tab" onClick={add}>+</ZButton>
      <ZTabsList label="Open documents">
        {tabs.map((id) => (
          <ZTabsTrigger key={id} value={id} closable>
            Document {id}
          </ZTabsTrigger>
        ))}
      </ZTabsList>
      {tabs.map((id) => (
        <ZTabsPanel key={id} value={id}>
          Content of document {id}. Press Delete on a tab to close it.
        </ZTabsPanel>
      ))}
    </ZTabs>
  );
}

```

### Case: default

#### React
```tsx
import { ZTabs, ZTabsList, ZTabsPanel, ZTabsTrigger } from '@zelviora/react';

export function TabsDefault() {
  return (
    <ZTabs defaultValue="general">
      <ZTabsList label="Account settings">
        <ZTabsTrigger value="general">General</ZTabsTrigger>
        <ZTabsTrigger value="security">Security</ZTabsTrigger>
        <ZTabsTrigger value="notifications">Notifications</ZTabsTrigger>
      </ZTabsList>
      <ZTabsPanel value="general">Name, language and time zone.</ZTabsPanel>
      <ZTabsPanel value="security">Password and two-factor authentication.</ZTabsPanel>
      <ZTabsPanel value="notifications">Email and push notifications.</ZTabsPanel>
    </ZTabs>
  );
}

```

### Case: overflow

#### React
```tsx
import { ZStack, ZTabs, ZTabsList, ZTabsPanel, ZTabsTrigger } from '@zelviora/react';

const months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];

export function TabsOverflow() {
  return (
    <ZStack orientation="vertical" gap="lg" className="demo-narrow">
      {(['scroll', 'menu'] as const).map((overflow) => (
        <ZTabs key={overflow} defaultValue="January" overflow={overflow}>
          <ZTabsList label={`Monthly reports (${overflow})`}>
            {months.map((m) => (
              <ZTabsTrigger key={m} value={m}>
                {m} report
              </ZTabsTrigger>
            ))}
          </ZTabsList>
          {months.map((m) => (
            <ZTabsPanel key={m} 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.'}
            </ZTabsPanel>
          ))}
        </ZTabs>
      ))}
    </ZStack>
  );
}

```

### Case: vertical

#### React
```tsx
import { ZTabs, ZTabsList, ZTabsPanel, ZTabsTrigger } from '@zelviora/react';

export function TabsVertical() {
  return (
    <ZTabs orientation="vertical" variant="soft" activationMode="manual" defaultValue="profile">
      <ZTabsList label="Profile sections">
        <ZTabsTrigger value="profile">Profile</ZTabsTrigger>
        <ZTabsTrigger value="billing">Billing</ZTabsTrigger>
        <ZTabsTrigger value="team" disabled>Team</ZTabsTrigger>
      </ZTabsList>
      <ZTabsPanel value="profile">Arrow keys move focus; Enter or Space selects (manual activation).</ZTabsPanel>
      <ZTabsPanel value="billing">Invoices and payment methods.</ZTabsPanel>
      <ZTabsPanel value="team">Team members.</ZTabsPanel>
    </ZTabs>
  );
}

```


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

#### React
```tsx
import { ZStack, ZTag } from '@zelviora/react';

export function TagBasic() {
  return (
    <ZStack orientation="horizontal" gap="sm" wrap>
      <ZTag>New</ZTag>
      <ZTag tone="success">Approved</ZTag>
      <ZTag tone="warning">Pending</ZTag>
    </ZStack>
  );
}

```

### Case: icon

#### React
```tsx
import { ZAvatar, ZIcon, ZStack, ZTag } from '@zelviora/react';

export function TagIcon() {
  return (
    <ZStack orientation="horizontal" alignItems="center" gap="sm" wrap>
      <ZTag tone="info">
        <ZIcon slot="icon-start" name="chevron_right" />
        Next
      </ZTag>
      <ZTag removable value="an">
        <ZAvatar slot="icon-start" size="xs" name="Anna Lee" alt="" />
        Anna Lee
      </ZTag>
    </ZStack>
  );
}

```

### Case: removable

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZStack, ZTag, ZText } from '@zelviora/react';

const provinces = ['London', 'Boston', 'Sydney', 'Toronto', 'San Francisco – Mission District Regional Office'];

export function TagRemovable() {
  const [items, setItems] = useState(provinces);
  return (
    <ZStack gap="sm">
      <ZStack orientation="horizontal" gap="sm" wrap>
        {items.map((name) => (
          <ZTag key={name} removable value={name} onZRemove={(e) => setItems((list) => list.filter((n) => n !== e.detail.value))}>
            {name}
          </ZTag>
        ))}
      </ZStack>
      <ZStack orientation="horizontal" alignItems="center" gap="sm">
        <ZText variant="muted" size="sm">{items.length} selected</ZText>
        <ZButton size="sm" variant="ghost" tone="neutral" onClick={() => setItems(provinces)}>Reset</ZButton>
      </ZStack>
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZStack, ZTag } from '@zelviora/react';

const variants = ['soft', 'solid', 'outline'] as const;
const tones = ['neutral', 'primary', 'success', 'warning', 'destructive', 'info'] as const;
const sizes = ['sm', 'md', 'lg'] as const;

export function TagVariants() {
  return (
    <ZStack gap="md">
      {variants.map((variant) => (
        <ZStack key={variant} orientation="horizontal" gap="sm" wrap>
          {tones.map((tone) => (
            <ZTag key={tone} variant={variant} tone={tone}>
              {tone}
            </ZTag>
          ))}
        </ZStack>
      ))}
      <ZStack orientation="horizontal" alignItems="center" gap="sm">
        {sizes.map((size) => (
          <ZTag key={size} size={size} removable>
            Size {size}
          </ZTag>
        ))}
        <ZTag removable disabled>Disabled</ZTag>
      </ZStack>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZStack, ZTagsInput } from '@zelviora/react';

/** Enter or a comma adds a tag; Backspace in the empty input reaches the last tag; clear all. */
export function TagsInputDefault() {
  const [tags, setTags] = useState<string[]>([]);
  return (
    <ZStack className="demo-narrow">
      <ZTagsInput label="Keywords" placeholder="Type, then press Enter" clearable value={tags} onZChange={(e) => setTags(e.detail.value)} />
      <span>Value: {tags.length ? tags.join(' | ') : 'none'}</span>
    </ZStack>
  );
}

```

### Case: editable

#### React
```tsx
import { useState } from 'react';
import { ZStack, ZTagsInput } from '@zelviora/react';

/** Double-click, Enter or F2 on a tag edits it; at most 5 tags, at least 2. */
export function TagsInputEditable() {
  const [labels, setLabels] = useState<string[]>(['urgent', 'frontend', 'in progress']);
  return (
    <ZStack className="demo-narrow">
      <ZTagsInput label="Labels" hint="2 to 5 labels; double-click a tag to edit it" editable maxCount={5} minCount={2} value={labels} onZChange={(e) => setLabels(e.detail.value)} />
    </ZStack>
  );
}

```

### Case: form

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZField, ZStack, ZTagsInput } from '@zelviora/react';

/** Native form: one FormData entry per tag (getAll); required inside a field; reset. */
export function TagsInputForm() {
  const [sent, setSent] = useState('');
  return (
    <form
      className="demo-narrow"
      onSubmit={(e) => {
        e.preventDefault();
        setSent(JSON.stringify(new FormData(e.currentTarget).getAll('to')));
      }}
    >
      <ZStack>
        <ZField label="Recipients" hint="Press Enter after each address" required>
          <ZTagsInput name="to" required />
        </ZField>
        <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
          <ZButton type="submit">Submit</ZButton>
          <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
        </ZStack>
        {sent && <output>{sent}</output>}
      </ZStack>
    </form>
  );
}

```

### Case: validate

#### React
```tsx
import { useState } from 'react';
import { ZStack, ZTagsInput } from '@zelviora/react';

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. */
export function TagsInputValidate() {
  const [error, setError] = useState('');
  return (
    <ZStack className="demo-narrow">
      <ZTagsInput label="Email" hint="Paste or type addresses separated by , ; or a space" delimiters={DELIMITERS} validate={isEmail} onZError={(e) => setError(`${e.detail.error.reason}: ${e.detail.error.tag}`)} />
      <span>Last rejection: {error || 'none'}</span>
    </ZStack>
  );
}

```


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

#### React
```tsx
import {
  ZStack,
  ZTerminal,
  ZText,
  type ZTerminalCommandDefinition,
  type ZTerminalEntry,
} from '@zelviora/react';

const INITIAL_ENTRIES: 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',
  },
];

const 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(' '),
  },
];

export function TerminalBasic() {
  return (
    <ZStack gap="sm">
      <ZTerminal
        className="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={INITIAL_ENTRIES}
        commands={COMMANDS}
      />
      <ZText 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.
      </ZText>
    </ZStack>
  );
}

```

### Case: i18n

#### React
```tsx
import {
  ZStack,
  ZTerminal,
  type ZTerminalCommandDefinition,
  type ZTerminalEntry,
} from '@zelviora/react';

const NHAT_KY_DAU: 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).',
  },
];

const LENH_HO_TRO: 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)',
  },
];

export function TerminalI18n() {
  return (
    <ZStack>
      <ZTerminal
        className="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={NHAT_KY_DAU}
        commands={LENH_HO_TRO}
      />
    </ZStack>
  );
}

```

### Case: readonly

#### React
```tsx
import { useState } from 'react';
import {
  ZButton,
  ZStack,
  ZTerminal,
  type ZTerminalEntry,
  type ZTerminalTheme,
} from '@zelviora/react';

const INITIAL_LOGS: 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)',
  },
];

export function TerminalReadonly() {
  const [theme, setTheme] = useState<ZTerminalTheme>('dark');
  const [entries, setEntries] = useState<ZTerminalEntry[]>(INITIAL_LOGS);

  const appendLog = () => {
    const nextIndex = entries.length + 1;
    const now = new Date().toTimeString().slice(0, 8);
    setEntries((prev) => [
      ...prev,
      {
        id: `log-${nextIndex}`,
        kind: 'output',
        timestamp: now,
        text: `\u001b[1;32mOK\u001b[0m    [health] Heartbeat check #${nextIndex} completed in 6ms`,
      },
    ]);
  };

  return (
    <ZStack gap="sm">
      <ZStack orientation="horizontal" alignItems="center" gap="sm" wrap>
        <ZButton
          variant={theme === 'dark' ? 'solid' : 'outline'}
          size="sm"
          onClick={() => setTheme('dark')}
        >
          Dark
        </ZButton>
        <ZButton
          variant={theme === 'light' ? 'solid' : 'outline'}
          size="sm"
          onClick={() => setTheme('light')}
        >
          Light
        </ZButton>
        <ZButton
          variant={theme === 'auto' ? 'solid' : 'outline'}
          size="sm"
          onClick={() => setTheme('auto')}
        >
          Auto
        </ZButton>
        <ZButton variant="soft" size="sm" onClick={appendLog}>
          Append log line
        </ZButton>
      </ZStack>
      <ZTerminal
        className="demo-terminal-frame"
        heading="k8s-pod/api-gateway-7f9c — logs"
        theme={theme}
        readonly
        timestamps
        entries={entries}
      />
    </ZStack>
  );
}

```

### Case: streaming

#### React
```tsx
import { useRef, type ComponentRef } from 'react';
import {
  ZButton,
  ZStack,
  ZTerminal,
  type ZTerminalCommandHandler,
  type ZTerminalEntry,
} from '@zelviora/react';

const INITIAL_STEPS: ZTerminalEntry[] = [
  { id: 's-1', kind: 'system', text: 'Pipeline runner connected. Ready for build or test tasks.' },
];

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 },
    );
  });
}

const STREAM_HANDLER: 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".`,
  };
};

export function TerminalStreaming() {
  const termRef = useRef<ComponentRef<typeof ZTerminal>>(null);

  return (
    <ZStack gap="sm">
      <ZStack orientation="horizontal" alignItems="center" gap="sm" wrap>
        <ZButton variant="solid" size="sm" onClick={() => void termRef.current?.execute('build')}>
          Run build
        </ZButton>
        <ZButton variant="outline" size="sm" onClick={() => void termRef.current?.execute('test')}>
          Run tests
        </ZButton>
      </ZStack>
      <ZTerminal
        ref={termRef}
        className="demo-terminal-frame"
        heading="ci-runner — pipeline"
        cwd="~/workspace"
        entries={INITIAL_STEPS}
        commandHandler={STREAM_HANDLER}
      />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZStack, ZText } from '@zelviora/react';

const variants = ['body', 'muted', 'strong', 'caption', 'code'] as const;

/** Vietnamese diacritics stack above and below the letters (Ễ Ỗ Ữ): no variant clips them. */
export function TextI18n() {
  return (
    <ZStack gap="sm">
      {variants.map((variant) => (
        <ZText key={variant} as="p" variant={variant} lang="vi">
          {variant}: Tiếng Việt có dấu chồng — Ễ Ỗ Ữ
        </ZText>
      ))}
    </ZStack>
  );
}

```

### Case: truncate

#### React
```tsx
import { ZHeading, ZStack, ZText } from '@zelviora/react';

const 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.';

export function TextTruncate() {
  return (
    <ZStack gap="md" className="demo-narrow">
      <ZHeading level={3} size="md" truncate>
        {long}
      </ZHeading>
      <ZText as="p" truncate={3}>
        {long} {long}
      </ZText>
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZStack, ZText } from '@zelviora/react';

const variants = ['body', 'muted', 'strong', 'caption', 'code'] as const;
const tones = ['primary', 'success', 'warning', 'destructive', 'info'] as const;

export function TextVariants() {
  return (
    <ZStack gap="sm">
      {variants.map((variant) => (
        <ZText key={variant} as="p" variant={variant}>
          {variant}: The quick brown fox jumps over the lazy dog
        </ZText>
      ))}
      <ZStack orientation="horizontal" gap="md" wrap>
        {tones.map((tone) => (
          <ZText key={tone} tone={tone}>{tone}</ZText>
        ))}
      </ZStack>
      <ZStack orientation="horizontal" alignItems="center" gap="md">
        <ZText size="sm">Small</ZText>
        <ZText size="md">Medium</ZText>
        <ZText size="lg">Large</ZText>
      </ZStack>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZTextarea } from '@zelviora/react';

export function TextareaAutoResize() {
  return (
    <div className="demo-narrow">
      <ZTextarea label="Message" autoResize rows={2} maxRows={6} hint="Grows from 2 to 6 lines, then scrolls" />
    </div>
  );
}

```

### Case: basic

#### React
```tsx
import { ZTextarea } from '@zelviora/react';

export function TextareaBasic() {
  return <ZTextarea label="Note" name="note" placeholder="Anything we should know?" />;
}

```

### Case: count

#### React
```tsx
import { ZTextarea } from '@zelviora/react';

export function TextareaCount() {
  return (
    <div className="demo-narrow">
      <ZTextarea label="Review" name="review" showCount clearable maxLength={200} minLength={20} defaultValue="The pho was great 🍜" />
    </div>
  );
}

```


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

#### React
```tsx
import { ZThemeRiverChart } from '@zelviora/react-chart';
import { riverItems, riverSeries } from '../data.ts';

export function ThemeRiverChartBasic() {
  return (
    <ZThemeRiverChart
      heading="Documentation Search Topic Streamgraph"
      description="Evolution of search interest across Components, Tokens, and Charts over four weeks."
      riverData={riverItems} series={riverSeries}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/react';
import { ZThemeRiverChart } from '@zelviora/react-chart';
import { riverItems, riverSeries } from '../data.ts';

export function ThemeRiverChartControlled() {
  const [hidden, setHidden] = useState<string[]>([]);
  const [selected, setSelected] = useState<string>('Click any chart element to inspect');

  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <ZButton
          size="sm"
          variant="outline"
          onClick={() => setHidden([])}
        >
          Show All Series
        </ZButton>
        <ZBadge tone="primary" variant="soft">
          {selected}
        </ZBadge>
        <ZText variant="muted" size="sm">
          Hidden: {hidden.length ? hidden.join(', ') : 'none'}
        </ZText>
      </ZStack>
      <ZThemeRiverChart
        heading="Documentation Search Topic Streamgraph (Interactive)"
        description="Evolution of search interest across Components, Tokens, and Charts over four weeks."
        riverData={riverItems} series={riverSeries}
        selectable
        hiddenSeries={hidden}
        onZSeriesToggle={(e) => setHidden(e.detail.hiddenSeries)}
        onZPointSelect={(e) =>
          setSelected(`Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`)
        }
      />
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZThemeRiverChart } from '@zelviora/react-chart';
import { riverItems, riverSeries } from '../data.ts';

export function ThemeRiverChartCustomization() {
  return (
    <ZThemeRiverChart
      className="demo-chart-brand"
      description="Evolution of search interest across Components, Tokens, and Charts over four weeks."
      valueFormat={{ maximumFractionDigits: 1 }}
      riverData={riverItems} series={riverSeries} renderer="canvas"
    >
      <span slot="heading">Documentation Search Topic Streamgraph — Custom Theme Tokens &amp; Canvas</span>
    </ZThemeRiverChart>
  );
}

```

### Case: states

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZThemeRiverChart } from '@zelviora/react-chart';
import { riverItems, riverSeries } from '../data.ts';

export function ThemeRiverChartStates() {
  return (
    <ZStack gap="lg">
      <ZThemeRiverChart
        heading="Loading State (aria-busy)"
        loading
        riverData={riverItems} series={riverSeries}
      />
      <ZThemeRiverChart
        heading="Empty State"
        riverData={[]}
        series={riverSeries}
      />
      <ZThemeRiverChart
        heading="Expanded Accessible Data Table"
        description="Evolution of search interest across Components, Tokens, and Charts over four weeks."
        showDataTable
        riverData={riverItems} series={riverSeries}
      />
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZThemeRiverChart } from '@zelviora/react-chart';
import { riverItems, riverSeries } from '../data.ts';

export function ThemeRiverChartVariants() {
  return (
    <ZStack gap="lg">
      <ZThemeRiverChart
        heading="Labeled Stream Ribbons"
        description="Streamgraph with inline series labels vs clean unlabeled stream ribbons."
        riverData={riverItems} series={riverSeries} showLabel
      />
      <ZThemeRiverChart
        heading="Clean Streamgraph Ribbons"
        description="Streamgraph with inline series labels vs clean unlabeled stream ribbons."
        riverData={riverItems} series={riverSeries} showLabel={false}
      />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZStack, ZTimePicker } from '@zelviora/react';

/** The app owns `value`: buttons set it from code (no event), the log lists user changes and popup changes. */
export function TimePickerControlled() {
  const [value, setValue] = useState<string | null>('09:00');
  const [log, setLog] = useState<string[]>([]);
  const add = (line: string) => setLog((l) => [line, ...l].slice(0, 5));
  return (
    <ZStack className="demo-narrow">
      <ZTimePicker
        label="Reminder time"
       
        now={() => '09:41'}
        value={value}
        onZChange={(e) => { setValue(e.detail.value); add(`zChange ${e.detail.value}`); }}
        onZOpenChange={(e) => add(`zOpenChange ${e.detail.open} (${e.detail.reason})`)}
      />
      <ZStack orientation="horizontal" gap="sm" wrap>
        <ZButton variant="outline" tone="neutral" onClick={() => setValue('17:30')}>Set 17:30</ZButton>
        <ZButton variant="outline" tone="neutral" onClick={() => setValue(null)}>Clear</ZButton>
      </ZStack>
      <span>Value: {value ?? 'null'}</span>
      <output>{log.join(' · ')}</output>
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZTimePicker } from '@zelviora/react';

/** Component tokens and the `option-selected` part: see the `demo-time-picker-brand` rule in README. */
export function TimePickerCustomization() {
  return <ZTimePicker className="demo-narrow demo-time-picker-brand" label="Appointment time" defaultValue="10:30" />;
}

```

### Case: default

#### React
```tsx
import { useState } from 'react';
import { ZStack, ZTimePicker } from '@zelviora/react';

/** Type hours and minutes, or press Alt+ArrowDown to pick in the columns; "Now" is fixed so the demo never changes. */
export function TimePickerDefault() {
  const [value, setValue] = useState<string | null>(null);
  return (
    <ZStack className="demo-narrow">
      <ZTimePicker
        label="Appointment time"
       
        hint="Type hours:minutes or press Alt+↓ to open the list"
        clearable
        now={() => '09:41'}
        value={value}
        onZChange={(e) => setValue(e.detail.value)}
      />
      <span>Value: {value ?? 'null'}</span>
    </ZStack>
  );
}

```

### Case: form

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZField, ZStack, ZTimePicker } from '@zelviora/react';

/** Native form: the value is submitted as HH:mm (FormData), required inside a field, reset restores defaults. */
export function TimePickerForm() {
  const [sent, setSent] = useState('');
  return (
    <form
      className="demo-narrow"
      onSubmit={(e) => {
        e.preventDefault();
        setSent(JSON.stringify([...new FormData(e.currentTarget).entries()]));
      }}
    >
      <ZStack>
        <ZField label="Delivery time" hint="From 08:00 to 20:00" required>
          <ZTimePicker name="delivery" min="08:00" max="20:00" required />
        </ZField>
        <ZTimePicker name="reminder" label="Reminder time" defaultValue="07:30" />
        <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
          <ZButton type="submit">Submit</ZButton>
          <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
        </ZStack>
        {sent && <output>{sent}</output>}
      </ZStack>
    </form>
  );
}

```

### Case: i18n

#### React
```tsx
import { ZGrid, ZTimePicker } from '@zelviora/react';

/** The hour cycle follows the locale (vi 24 h, en-US 12 h with AM/PM); the value stays 24 h. Arabic in RTL. */
export function TimePickerI18n() {
  return (
    <ZGrid columns="1 sm:2" gap="md">
      <ZTimePicker label="Tiếng Việt (24 giờ)" locale="vi" defaultValue="14:30" />
      <ZTimePicker label="English US (12 hours)" locale="en-US" defaultValue="14:30" />
      <ZTimePicker label="Forced 12 hours in Vietnamese" locale="vi" hourCycle="h12" defaultValue="14:30" />
      <div dir="rtl" lang="ar-EG">
        <ZTimePicker label="العربية" locale="ar-EG" defaultValue="14:30" />
      </div>
    </ZGrid>
  );
}

```

### Case: seconds

#### React
```tsx
import { ZGrid, ZTimePicker } from '@zelviora/react';

/** Granularity: `second` adds a seconds segment and column (HH:mm:ss); `hour` keeps minutes at 00. */
export function TimePickerSeconds() {
  return (
    <ZGrid columns="1 sm:2" gap="md">
      <ZTimePicker label="Time (seconds)" granularity="second" secondStep={5} defaultValue="08:15:30" />
      <ZTimePicker label="Hour slot" granularity="hour" defaultValue="08:00" />
    </ZGrid>
  );
}

```

### Case: states

#### React
```tsx
import { ZGrid, ZTimePicker } from '@zelviora/react';

/** Empty, filled, disabled, readonly, invalid and display statuses; a long label in a narrow column wraps. */
export function TimePickerStates() {
  return (
    <ZGrid columns="1 sm:2" gap="md">
      <ZTimePicker label="Empty" />
      <ZTimePicker label="With value" defaultValue="14:15" />
      <ZTimePicker label="Disabled" defaultValue="14:15" disabled />
      <ZTimePicker label="Readonly" defaultValue="14:15" readonly />
      <ZTimePicker label="Invalid" defaultValue="14:15" invalid />
      <ZTimePicker label="Warning" defaultValue="14:15" status="warning" />
      <ZTimePicker label="Success" defaultValue="14:15" status="success" />
      <ZTimePicker
        className="demo-narrow"
        label="Expected start time of the afternoon shift at the downtown branch"
       
        defaultValue="13:30"
      />
    </ZGrid>
  );
}

```

### Case: steps

#### React
```tsx
import { ZTimePicker } from '@zelviora/react';

/** Office hours only (08:00–17:30) in 15-minute steps; PageUp/PageDown jump further, Home/End go to the limits. */
export function TimePickerSteps() {
  return (
    <ZTimePicker
      className="demo-narrow"
      label="Working hours"
     
      min="08:00"
      max="17:30"
      minuteStep={15}
      hint="08:00–17:30, 15-minute steps"
    />
  );
}

```

### Case: unavailable

#### React
```tsx
import { ZTimePicker } from '@zelviora/react';

/** The lunch break (12:00–12:59) cannot be picked; typing it is an error. The footer slot adds a note. */
const isLunch = (time: string) => time.startsWith('12:');

export function TimePickerUnavailable() {
  return (
    <ZTimePicker className="demo-narrow" label="Appointment time" minuteStep={30} isTimeUnavailable={isLunch}>
      <span slot="footer">Lunch break 12:00–13:00</span>
    </ZTimePicker>
  );
}

```

### Case: validation

#### React
```tsx
import { ZButton, ZStack, ZTimePicker } from '@zelviora/react';

/** Required, a range (min / max) with a localized message, and a value off the minute step. */
export function TimePickerValidation() {
  return (
    <form className="demo-narrow" onSubmit={(e) => e.preventDefault()}>
      <ZStack>
        <ZTimePicker name="start" label="Start time" required />
        <ZTimePicker name="office" label="Office hours (08:00–17:00)" min="08:00" max="17:00" defaultValue="18:30" />
        <ZTimePicker name="slot" label="15-minute step" minuteStep={15} defaultValue="10:10" hint="10:10 is not on a 15-minute step" />
        <ZButton type="submit">Submit</ZButton>
      </ZStack>
    </form>
  );
}

```

### Case: variants

#### React
```tsx
import { ZGrid, ZTimePicker } from '@zelviora/react';

/** Outline and filled field in every size. */
export function TimePickerVariants() {
  return (
    <ZGrid columns="1 sm:3" gap="md">
      <ZTimePicker label="Small" size="sm" defaultValue="08:30" />
      <ZTimePicker label="Medium" size="md" defaultValue="08:30" />
      <ZTimePicker label="Large" size="lg" defaultValue="08:30" />
      <ZTimePicker label="Small filled" size="sm" variant="filled" />
      <ZTimePicker label="Medium filled" size="md" variant="filled" />
      <ZTimePicker label="Large filled" size="lg" variant="filled" />
    </ZGrid>
  );
}

```


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

#### React
```tsx
import { ZTimeline, ZTimelineItem } from '@zelviora/react';

export function TimelineBasic() {
  return (
    <ZTimeline label="Order history">
      <ZTimelineItem heading="Order placed" time="2026-10-01T08:15:00+07:00">Paid by card.</ZTimelineItem>
      <ZTimelineItem heading="Packed" time="2026-10-01T14:40:00+07:00">Warehouse Hanoi.</ZTimelineItem>
      <ZTimelineItem heading="Shipped" time="2026-10-02T07:05:00+07:00">Carrier: GHN, tracking 8234 1102.</ZTimelineItem>
      <ZTimelineItem heading="Delivered" time="2026-10-02T16:30:00+07:00" tone="success">Received by the customer.</ZTimelineItem>
    </ZTimeline>
  );
}

```

### Case: custom

#### React
```tsx
import { ZCard, ZLink, ZTimeline, ZTimelineItem } from '@zelviora/react';

export function TimelineCustom() {
  return (
    <ZCard heading="Activity">
      <ZTimeline label="Activity">
        <ZTimelineItem 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.” <ZLink href="#comment-12">View comment</ZLink>
        </ZTimelineItem>
        <ZTimelineItem 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.
        </ZTimelineItem>
      </ZTimeline>
    </ZCard>
  );
}

```

### Case: horizontal

#### React
```tsx
import { ZTimeline, ZTimelineItem } from '@zelviora/react';

const steps = ['Ordered', 'Confirmed', 'Packed', 'Shipped', 'Out for delivery', 'Delivered'];

export function TimelineHorizontal() {
  return (
    <ZTimeline label="Shipment" orientation="horizontal">
      {steps.map((heading, i) => (
        <ZTimelineItem key={heading} heading={heading} tone={i < 3 ? 'success' : 'neutral'}>
          <span slot="opposite">Day {i + 1}</span>
        </ZTimelineItem>
      ))}
    </ZTimeline>
  );
}

```

### Case: layouts

#### React
```tsx
import { ZGrid, ZTimeline, ZTimelineItem } from '@zelviora/react';

const layouts = ['start', 'alternate', 'end'] as const;

export function TimelineLayouts() {
  return (
    <ZGrid columns="1 md:3" gap="lg">
      {layouts.map((layout) => (
        <ZTimeline key={layout} label={`Layout ${layout}`} layout={layout}>
          <ZTimelineItem heading="Kick-off"><span slot="opposite">Mon</span>Scope agreed.</ZTimelineItem>
          <ZTimelineItem heading="Design"><span slot="opposite">Wed</span>Wireframes approved.</ZTimelineItem>
          <ZTimelineItem heading="Build"><span slot="opposite">Fri</span>First release.</ZTimelineItem>
        </ZTimeline>
      ))}
    </ZGrid>
  );
}

```

### Case: pending

#### React
```tsx
import { ZTimeline, ZTimelineItem } from '@zelviora/react';

const hoursAgo = (h: number) => new Date(Date.now() - h * 3600_000).toISOString();

export function TimelinePending() {
  return (
    <ZTimeline label="Import" pending pendingLabel="Importing contacts…">
      <ZTimelineItem heading="File uploaded" time={hoursAgo(3)} timeFormat="relative" tone="success" />
      <ZTimelineItem heading="Columns mapped" time={hoursAgo(1)} timeFormat="relative" tone="success" />
    </ZTimeline>
  );
}

```

### Case: sizes

#### React
```tsx
import { ZGrid, ZTimeline, ZTimelineItem } from '@zelviora/react';

const sizes = ['sm', 'md', 'lg'] as const;

export function TimelineSizes() {
  return (
    <ZGrid columns="1 md:3" gap="lg">
      {sizes.map((size) => (
        <ZTimeline key={size} label={`Size ${size}`} size={size}>
          <ZTimelineItem heading="Created" time="2026-09-30" timeFormat="date" />
          <ZTimelineItem heading="Updated" time="2026-10-04" timeFormat="date" />
        </ZTimeline>
      ))}
    </ZGrid>
  );
}

```

### Case: tones

#### React
```tsx
import { ZTimeline, ZTimelineItem } from '@zelviora/react';

export function TimelineTones() {
  return (
    <ZTimeline label="Deploy log">
      <ZTimelineItem heading="Build started" tone="info">Commit 3d132c5.</ZTimelineItem>
      <ZTimelineItem heading="Tests passed" tone="success">812 tests.</ZTimelineItem>
      <ZTimelineItem heading="Warning: slow step" tone="warning">Docs build took 2 minutes.</ZTimelineItem>
      <ZTimelineItem heading="Error: deploy failed" tone="destructive">The server rejected the upload (HTTP 503).</ZTimelineItem>
    </ZTimeline>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZToastRegion, toast, ZStack } from '@zelviora/react';

/** Notification with an action: it does not close by itself (MO-4); F8 moves focus to it. */
export function ToastAction() {
  const [files, setFiles] = useState(3);
  return (
    <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
      <ZToastRegion name="demo-action" placement="top-end" />
      <span>Files: {files}</span>
      <ZButton
        variant="outline"
        tone="destructive"
        disabled={files === 0}
        onClick={() => {
          setFiles((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: () => setFiles((n) => n + 1) },
          });
        }}
      >
        Delete a file
      </ZButton>
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { ZButton, ZToastRegion, toast, ZStack } from '@zelviora/react';

/** Put one region in the app layout; call toast() from anywhere. */
export function ToastDefault() {
  return (
    <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
      <ZToastRegion name="demo-default" />
      <ZButton onClick={() => toast('Changes saved', { region: 'demo-default' })}>Save</ZButton>
      <ZButton variant="outline" tone="success" onClick={() => toast.success('Uploaded 3 files', { region: 'demo-default' })}>
        Upload
      </ZButton>
      <ZButton variant="outline" tone="destructive" onClick={() => toast.error('Could not reach the server', { region: 'demo-default' })}>
        Fail
      </ZButton>
    </ZStack>
  );
}

```

### Case: promise

#### React
```tsx
import { ZButton, ZToastRegion, toast, ZStack } from '@zelviora/react';

const fakeSave = () => new Promise<number>((resolve) => setTimeout(() => resolve(12), 1500));

/** A loading toast that turns into success or error when the promise settles. */
export function ToastPromise() {
  return (
    <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
      <ZToastRegion name="demo-promise" placement="bottom" showProgress />
      <ZButton
        onClick={() =>
          void toast.promise(
            fakeSave(),
            { loading: 'Saving 12 records…', success: (n) => `Saved ${n} records`, error: 'Saving failed' },
            { region: 'demo-promise' },
          )
        }
      >
        Save records
      </ZButton>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZToggle } from '@zelviora/react';

export function ToggleBasic() {
  return <ZToggle defaultPressed>Pin</ZToggle>;
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZStack, ZToggle } from '@zelviora/react';

export function ToggleControlled() {
  const [grid, setGrid] = useState(false);
  const [log, setLog] = useState<string[]>([]);
  return (
    <ZStack gap="sm">
      <ZStack orientation="horizontal" alignItems="center" gap="sm" wrap>
        <ZToggle
          variant="outline"
          pressed={grid}
          onZChange={(e) => {
            setGrid(e.detail.pressed);
            setLog((l) => [`zChange pressed=${e.detail.pressed}`, ...l].slice(0, 3));
          }}
        >
          Grid view
        </ZToggle>
        <ZButton variant="ghost" tone="neutral" onClick={() => setGrid(false)}>Reset from code</ZButton>
      </ZStack>
      <small>View: {grid ? 'grid' : 'list'} · {log.join(' · ') || 'no event yet'}</small>
    </ZStack>
  );
}

```

### Case: toolbar

#### React
```tsx
import { useState } from 'react';
import { ZButtonGroup, ZStack, ZText, ZToggle } from '@zelviora/react';

export function ToggleToolbar() {
  const [format, setFormat] = useState({ bold: true, italic: false, underline: false });
  const set = (key: keyof typeof format) => (e: CustomEvent<{ pressed: boolean }>) => setFormat((f) => ({ ...f, [key]: e.detail.pressed }));
  return (
    <ZStack gap="sm">
      <ZButtonGroup label="Text format" detached>
        <ZToggle size="sm" label="Bold" pressed={format.bold} onZChange={set('bold')}>B</ZToggle>
        <ZToggle size="sm" label="Italic" pressed={format.italic} onZChange={set('italic')}>I</ZToggle>
        <ZToggle size="sm" label="Underline" pressed={format.underline} onZChange={set('underline')}>U</ZToggle>
      </ZButtonGroup>
      <ZText variant="muted" size="sm">
        Active: {Object.entries(format).filter(([, on]) => on).map(([k]) => k).join(', ') || 'none'}
      </ZText>
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZGrid, ZToggle } from '@zelviora/react';

const variants = ['ghost', 'outline'] as const;
const sizes = ['sm', 'md', 'lg'] as const;

export function ToggleVariants() {
  return (
    <ZGrid columns="1 sm:3" gap="md">
      {variants.map((variant) => [
        <ZToggle key={`${variant}-off`} variant={variant}>{variant} off</ZToggle>,
        <ZToggle key={`${variant}-on`} variant={variant} defaultPressed>{variant} on</ZToggle>,
        <ZToggle key={`${variant}-disabled`} variant={variant} defaultPressed disabled>{variant} disabled</ZToggle>,
      ])}
      {sizes.map((size) => (
        <ZToggle key={size} size={size} variant="outline">Size {size}</ZToggle>
      ))}
    </ZGrid>
  );
}

```


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

#### React
```tsx
import { ZToggleGroup, ZToggleGroupItem } from '@zelviora/react';

export function ToggleGroupDefault() {
  return (
    <ZToggleGroup label="Text alignment" defaultValue="center">
      <ZToggleGroupItem value="left">Left</ZToggleGroupItem>
      <ZToggleGroupItem value="center">Center</ZToggleGroupItem>
      <ZToggleGroupItem value="right">Right</ZToggleGroupItem>
    </ZToggleGroup>
  );
}

```

### Case: multiple

#### React
```tsx
import { useState } from 'react';
import { ZStack, ZToggleGroup, ZToggleGroupItem } from '@zelviora/react';

export function ToggleGroupMultiple() {
  const [value, setValue] = useState<string[]>(['bold']);
  return (
    <ZStack gap="sm">
      <ZToggleGroup multiple variant="outline" label="Formatting" value={value} onZChange={(e) => setValue(e.detail.value as string[])}>
        <ZToggleGroupItem value="bold" label="Bold">
          <strong slot="icon-start" aria-hidden="true">B</strong>
        </ZToggleGroupItem>
        <ZToggleGroupItem value="italic" label="Italic">
          <em slot="icon-start" aria-hidden="true">I</em>
        </ZToggleGroupItem>
        <ZToggleGroupItem value="underline" label="Underline">
          <u slot="icon-start" aria-hidden="true">U</u>
        </ZToggleGroupItem>
      </ZToggleGroup>
      <p>Pressed: {value.join(', ') || 'none'}</p>
    </ZStack>
  );
}

```

### Case: vertical

#### React
```tsx
import { ZToggleGroup, ZToggleGroupItem } from '@zelviora/react';

export function ToggleGroupVertical() {
  return (
    <ZToggleGroup label="View density" orientation="vertical" size="sm" disallowEmpty defaultValue="comfortable">
      <ZToggleGroupItem value="compact">Compact</ZToggleGroupItem>
      <ZToggleGroupItem value="comfortable">Comfortable</ZToggleGroupItem>
      <ZToggleGroupItem value="spacious" disabled>
        Spacious
      </ZToggleGroupItem>
    </ZToggleGroup>
  );
}

```


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

#### React
```tsx
import { ZButton, ZTooltip } from '@zelviora/react';

export function TooltipDefault() {
  return (
    <ZTooltip content="Saves a draft you can finish later">
      <ZButton variant="outline" tone="neutral">
        Save draft
      </ZButton>
    </ZTooltip>
  );
}

```

### Case: label

#### React
```tsx
import { ZButton, ZIcon, ZTooltip, ZStack } from '@zelviora/react';

/** Icon-only buttons get their accessible name from the tooltip (kind="label"). */
export function TooltipLabel() {
  return (
    <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
      <ZTooltip content="Next page" kind="label">
        <ZButton variant="ghost" tone="neutral">
          <ZIcon name="chevron_right" flipRtl />
        </ZButton>
      </ZTooltip>
      <ZTooltip content="Remove filter" kind="label" placement="bottom">
        <ZButton variant="ghost" tone="neutral">
          <ZIcon name="close" />
        </ZButton>
      </ZTooltip>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZStack, ZText, ZTour, ZTourStep } from '@zelviora/react';

/** Controlled `index`, an intro step without target (centered) and no mask. */
export function TourControlled() {
  const [open, setOpen] = useState(false);
  const [index, setIndex] = useState(0);
  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
        <ZButton id="tour-react-export" variant="outline" tone="neutral">
          Export
        </ZButton>
        <ZText variant="muted">Step {index + 1} of 2</ZText>
      </ZStack>
      <div>
        <ZButton variant="outline" onClick={() => { setIndex(0); setOpen(true); }}>
          What is new?
        </ZButton>
      </div>
      <ZTour hideMask open={open} index={index} onZOpenChange={(e) => setOpen(e.detail.open)} onZChange={(e) => setIndex(e.detail.index)}>
        <ZTourStep heading="Welcome to version 2">A short look at what changed.</ZTourStep>
        <ZTourStep target="#tour-react-export" heading="Export" placement="right">
          Download any report as CSV or PDF.
        </ZTourStep>
      </ZTour>
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZStack, ZTour, ZTourStep } from '@zelviora/react';

export function TourDefault() {
  const [open, setOpen] = useState(false);
  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" wrap gap="sm">
        <ZButton id="tour-react-new">New project</ZButton>
        <ZButton id="tour-react-search" variant="outline" tone="neutral">
          Search
        </ZButton>
        <ZButton id="tour-react-settings" variant="ghost" tone="neutral">
          Settings
        </ZButton>
      </ZStack>
      <div>
        <ZButton variant="outline" onClick={() => setOpen(true)}>
          Start tour
        </ZButton>
      </div>
      <ZTour open={open} onZOpenChange={(e) => setOpen(e.detail.open)}>
        <ZTourStep target="#tour-react-new" heading="Create a project">
          Start here: a project groups your boards and files.
        </ZTourStep>
        <ZTourStep target="#tour-react-search" heading="Find anything">
          Search projects, people and files.
        </ZTourStep>
        <ZTourStep target="#tour-react-settings" heading="Make it yours" placement="right">
          Theme, language and notifications live here.
        </ZTourStep>
      </ZTour>
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZStack, ZTransfer } from '@zelviora/react';

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. */
export function TransferControlled() {
  const [value, setValue] = useState<string[]>(['read', 'comment']);
  const [log, setLog] = useState<string[]>([]);
  const add = (line: string) => setLog((l) => [line, ...l].slice(0, 5));
  return (
    <ZStack>
      <ZTransfer
        label="Permissions"
        items={ROLES}
        value={value}
        onZChange={(e) => { setValue(e.detail.value); add(`zChange ${e.detail.direction} [${e.detail.moved.join(', ')}]`); }}
        onZSelectionChange={(e) => add(`zSelectionChange [${e.detail.selectedSource.join(', ')}] [${e.detail.selectedTarget.join(', ')}]`)}
      />
      <ZStack orientation="horizontal" gap="sm" wrap>
        <ZButton variant="outline" tone="neutral" onClick={() => setValue(ROLES.filter((r) => !r.disabled).map((r) => r.value))}>All</ZButton>
        <ZButton variant="outline" tone="neutral" onClick={() => setValue([])}>None</ZButton>
      </ZStack>
      <span>Value: {value.join(', ') || '—'}</span>
      <output>{log.join(' · ')}</output>
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZTransfer } from '@zelviora/react';

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. */
export function TransferCustomization() {
  return <ZTransfer className="demo-transfer-brand" label="Customization" items={ROLES.slice(0, 6)} defaultValue={['read']} selectedSource={['write']} />;
}

```

### Case: default

#### React
```tsx
import { useState } from 'react';
import { ZStack, ZTransfer } from '@zelviora/react';

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. */
export function TransferDefault() {
  const [value, setValue] = useState<string[]>(['read']);
  return (
    <ZStack>
      <ZTransfer label="Permissions" items={ROLES} value={value} onZChange={(e) => setValue(e.detail.value)} />
      <span>Value: {value.join(', ') || '—'}</span>
    </ZStack>
  );
}

```

### Case: form

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZField, ZStack, ZTransfer } from '@zelviora/react';

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. */
export function TransferForm() {
  const [sent, setSent] = useState('');
  return (
    <form
      onSubmit={(e) => {
        e.preventDefault();
        setSent(JSON.stringify(new FormData(e.currentTarget).getAll('roles')));
      }}
    >
      <ZStack>
        <ZField label="Team permissions" hint="Select at least one permission" required>
          <ZTransfer name="roles" items={ROLES} defaultValue={['read']} required />
        </ZField>
        <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
          <ZButton type="submit">Submit</ZButton>
          <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
        </ZStack>
        {sent && <output>{sent}</output>}
      </ZStack>
    </form>
  );
}

```

### Case: i18n

#### React
```tsx
import { ZStack, ZTransfer } from '@zelviora/react';

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"). */
export function TransferI18n() {
  return (
    <ZStack>
      <ZTransfer lang="vi" label="Phân quyền" items={ROLES} defaultValue={['read']} searchable />
    </ZStack>
  );
}

```

### Case: long

#### React
```tsx
import { ZTransfer } from '@zelviora/react';

const 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}`,
}));

/** 10 000 items: each list scrolls virtually (above 200 items); typeahead and Shift+Arrow still work. */
export function TransferLong() {
  return <ZTransfer label="Users" items={MANY} searchable />;
}

```

### Case: one-way

#### React
```tsx
import { ZTransfer } from '@zelviora/react';

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. */
export function TransferOneWay() {
  return <ZTransfer label="Notification recipients" items={ROLES} defaultValue={['read', 'write']} oneWay titles={['Available', 'Receives notifications']} />;
}

```

### Case: rtl

#### React
```tsx
import { ZStack, ZTransfer } from '@zelviora/react';

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`). */
export function TransferRtl() {
  return (
    <ZStack gap="lg">
      <div dir="rtl" lang="ar">
        <ZTransfer label="RTL" items={ROLES.slice(0, 4)} defaultValue={['read']} />
      </div>
      <ZTransfer label="Empty" items={[]}>
        <span slot="empty-source">No permissions yet</span>
      </ZTransfer>
    </ZStack>
  );
}

```

### Case: searchable

#### React
```tsx
import { useState } from 'react';
import { ZStack, ZTransfer } from '@zelviora/react';

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. */
export function TransferSearchable() {
  const [query, setQuery] = useState('');
  return (
    <ZStack>
      <ZTransfer label="Permissions" items={ROLES} searchable onZSearch={(e) => setQuery(`${e.detail.side}: ${e.detail.query}`)} />
      <span>zSearch: {query || '—'}</span>
    </ZStack>
  );
}

```

### Case: sizes

#### React
```tsx
import { ZStack, ZTransfer } from '@zelviora/react';

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. */
export function TransferSizes() {
  return (
    <ZStack gap="lg">
      {(['sm', 'md', 'lg'] as const).map((size) => (
        <ZTransfer key={size} label={`Size ${size}`} size={size} items={ROLES.slice(0, 4)} defaultValue={['read']} />
      ))}
    </ZStack>
  );
}

```

### Case: states

#### React
```tsx
import { ZStack, ZTransfer } from '@zelviora/react';

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. */
export function TransferStates() {
  return (
    <ZStack gap="lg">
      <ZTransfer label="Ticked items and a disabled item" items={ROLES} defaultValue={['read']} selectedSource={['write', 'edit']} />
      <ZTransfer label="Disabled" items={ROLES.slice(0, 4)} defaultValue={['read']} disabled />
      <ZTransfer label="Readonly" items={ROLES.slice(0, 4)} defaultValue={['read']} readonly />
      <ZTransfer label="Invalid" items={ROLES.slice(0, 4)} invalid hint="Select at least one permission" />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { ZTreeChart } from '@zelviora/react-chart';
import { topologyTree, topologySeries } from '../data.ts';

export function TreeChartBasic() {
  return (
    <ZTreeChart
      heading="Platform Service Topology Tree"
      description="Hierarchical topology from Edge Ingress down to regional microservice clusters."
      treeData={topologyTree} series={topologySeries}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/react';
import { ZTreeChart } from '@zelviora/react-chart';
import { topologyTree, topologySeries } from '../data.ts';

export function TreeChartControlled() {
  const [hidden, setHidden] = useState<string[]>([]);
  const [selected, setSelected] = useState<string>('Click any chart element to inspect');

  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <ZButton
          size="sm"
          variant="outline"
          onClick={() => setHidden([])}
        >
          Show All Series
        </ZButton>
        <ZBadge tone="primary" variant="soft">
          {selected}
        </ZBadge>
        <ZText variant="muted" size="sm">
          Hidden: {hidden.length ? hidden.join(', ') : 'none'}
        </ZText>
      </ZStack>
      <ZTreeChart
        heading="Platform Service Topology Tree (Interactive)"
        description="Hierarchical topology from Edge Ingress down to regional microservice clusters."
        treeData={topologyTree} series={topologySeries}
        selectable
        hiddenSeries={hidden}
        onZSeriesToggle={(e) => setHidden(e.detail.hiddenSeries)}
        onZPointSelect={(e) =>
          setSelected(`Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`)
        }
      />
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZTreeChart } from '@zelviora/react-chart';
import { topologyTree, topologySeries } from '../data.ts';

export function TreeChartCustomization() {
  return (
    <ZTreeChart
      className="demo-chart-brand"
      description="Hierarchical topology from Edge Ingress down to regional microservice clusters."
      valueFormat={{ maximumFractionDigits: 1 }}
      treeData={topologyTree} series={topologySeries} roam symbolSize={12} renderer="canvas"
    >
      <span slot="heading">Platform Service Topology Tree — Custom Theme Tokens &amp; Canvas</span>
    </ZTreeChart>
  );
}

```

### Case: states

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZTreeChart } from '@zelviora/react-chart';
import { topologyTree, topologySeries } from '../data.ts';

export function TreeChartStates() {
  return (
    <ZStack gap="lg">
      <ZTreeChart
        heading="Loading State (aria-busy)"
        loading
        treeData={topologyTree} series={topologySeries}
      />
      <ZTreeChart
        heading="Empty State"
        treeData={[]}
        series={topologySeries}
      />
      <ZTreeChart
        heading="Expanded Accessible Data Table"
        description="Hierarchical topology from Edge Ingress down to regional microservice clusters."
        showDataTable
        treeData={topologyTree} series={topologySeries}
      />
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZTreeChart } from '@zelviora/react-chart';
import { topologyTree, topologySeries } from '../data.ts';

export function TreeChartVariants() {
  return (
    <ZStack gap="lg">
      <ZTreeChart
        heading="Top-to-Bottom Orthogonal Tree"
        description="Top-to-bottom orthogonal hierarchy vs radial circular tree layout."
        treeData={topologyTree} series={topologySeries} treeLayout="orthogonal" treeOrient="TB" symbolSize={10}
      />
      <ZTreeChart
        heading="Radial Tree Layout"
        description="Top-to-bottom orthogonal hierarchy vs radial circular tree layout."
        treeData={topologyTree} series={topologySeries} treeLayout="radial" initialTreeDepth={2}
      />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZStack, ZTreeSelect } from '@zelviora/react';
import { departments } from '../data.ts';

const STRATEGIES = ['parent', 'child', 'all'] as const;

/** Tri-state check boxes with cascade; the value kept follows checkStrategy (parent / child / all). */
export function TreeSelectCheckable() {
  const [values, setValues] = useState<Record<string, string[]>>({ parent: ['eng'], child: ['eng'], all: ['eng'] });
  return (
    <ZStack className="demo-narrow">
      {STRATEGIES.map((s) => (
        <ZStack key={s} gap="xs">
          <ZTreeSelect label={`checkStrategy: ${s}`} checkable checkStrategy={s} maxTagCount="responsive" options={departments} value={values[s]} onZChange={(e) => setValues({ ...values, [s]: e.detail.value as string[] })} />
          <span>Value: {values[s]!.join(', ') || 'none'}</span>
        </ZStack>
      ))}
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { useState } from 'react';
import { ZStack, ZTreeSelect } from '@zelviora/react';
import { departments } from '../data.ts';

/** Single value at any level, a disabled node, clear button; disabled and readonly states. */
export function TreeSelectDefault() {
  const [value, setValue] = useState<string | null>('be');
  return (
    <ZStack className="demo-narrow">
      <ZTreeSelect label="Departments" options={departments} value={value} clearable onZChange={(e) => setValue(e.detail.value as string | null)} />
      <span>Value: {value ?? 'null'}</span>
      <ZTreeSelect label="Disabled" options={departments} defaultValue="acc" disabled />
      <ZTreeSelect label="Readonly" options={departments} defaultValue="acc" readonly variant="filled" />
    </ZStack>
  );
}

```

### Case: form

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZStack, ZTreeSelect } from '@zelviora/react';
import { bigTree, departments } from '../data.ts';

/** Required value in a native form (one FormData entry per value, in tree order); 5,000 nodes are virtual. */
export function TreeSelectForm() {
  const [sent, setSent] = useState('');
  return (
    <form
      className="demo-narrow"
      onSubmit={(e) => {
        e.preventDefault();
        const data = new FormData(e.currentTarget);
        setSent(JSON.stringify({ teams: data.getAll('teams'), item: data.get('item') }));
      }}
    >
      <ZStack>
        <ZTreeSelect name="teams" label="Departments" hint="Required" required checkable checkStrategy="child" options={departments} />
        <ZTreeSelect name="item" label="Large catalog (5,000 nodes)" searchable options={bigTree} />
        <ZStack orientation="horizontal" wrap alignItems="center" gap="sm">
          <ZButton type="submit">Submit</ZButton>
          <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
        </ZStack>
        {sent && <output>{sent}</output>}
      </ZStack>
    </form>
  );
}

```

### Case: i18n

#### React
```tsx
import { ZConfigProvider, ZTreeSelect } from '@zelviora/react';
import { departments } from '../data-i18n.ts';

/** With locale `vi` the search ignores accents ("ke toan" finds "Kế toán" with its ancestors) and the built-in texts are Vietnamese. */
export function TreeSelectI18n() {
  return (
    <ZConfigProvider locale="vi">
      <div className="demo-narrow">
        <ZTreeSelect label="Tìm phòng ban" searchable options={departments} />
      </div>
    </ZConfigProvider>
  );
}

```

### Case: multiple

#### React
```tsx
import { useState } from 'react';
import { ZStack, ZTreeSelect } from '@zelviora/react';
import { departments } from '../data.ts';

/** Several nodes as tags (the popup stays open); at most 3 values. */
export function TreeSelectMultiple() {
  const [value, setValue] = useState<string[]>(['web', 'acc']);
  return (
    <ZStack className="demo-narrow">
      <ZTreeSelect label="Owner groups" multiple clearable maxCount={3} options={departments} value={value} onZChange={(e) => setValue(e.detail.value as string[])} />
      <span>Value: {value.join(', ') || 'none'}</span>
    </ZStack>
  );
}

```

### Case: search

#### React
```tsx
import { useState } from 'react';
import { ZStack, ZTreeSelect } from '@zelviora/react';
import { departments, lazyRoots, loadOffices } from '../data.ts';

/** Search shows matches with their ancestors; children loaded on expand. */
export function TreeSelectSearch() {
  const [query, setQuery] = useState('');
  return (
    <ZStack className="demo-narrow">
      <ZTreeSelect label="Find department" searchable options={departments} onZSearch={(e) => setQuery(e.detail.query)} />
      <span>Query: {query || '—'}</span>
      <ZTreeSelect label="Offices (lazy)" options={lazyRoots} loadChildren={loadOffices} />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useState } from 'react';
import { ZStack, ZTreeView } from '@zelviora/react';
import { departments } from '../data.ts';

/** Tri-state check boxes with cascade (the disabled team is skipped); `checkedValue` bound back from the event. */
export function TreeViewCheckable() {
  const [checked, setChecked] = useState<string[]>(['fe']);
  return (
    <ZStack className="demo-narrow">
      <ZTreeView
        label="Departments"
        checkable
        selectionMode="none"
        items={departments}
        checkedValue={checked}
        defaultExpandedValue={['eng', 'fin']}
        onZCheckedChange={(e) => setChecked(e.detail.checkedValue)}
      />
      <span>Checked: {checked.length ? checked.join(', ') : 'none'}</span>
    </ZStack>
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZStack, ZTreeView } from '@zelviora/react';
import { folders } from '../data.ts';

const ALL_PARENTS = ['docs', 'reports', 'images'];

/** The app owns `value` and `expandedValue`: buttons set them from code (no event), user changes come back by event. */
export function TreeViewControlled() {
  const [value, setValue] = useState<string | null>(null);
  const [expanded, setExpanded] = useState<string[]>([]);
  return (
    <ZStack className="demo-narrow">
      <ZStack orientation="horizontal" gap="sm" wrap>
        <ZButton variant="outline" tone="neutral" onClick={() => setExpanded(ALL_PARENTS)}>Expand all</ZButton>
        <ZButton variant="outline" tone="neutral" onClick={() => setExpanded([])}>Collapse all</ZButton>
        <ZButton variant="outline" tone="neutral" onClick={() => { setExpanded(['docs', 'reports']); setValue('q2'); }}>Select Q2</ZButton>
      </ZStack>
      <ZTreeView
        label="Folders"
        items={folders}
        value={value}
        expandedValue={expanded}
        onZSelectionChange={(e) => setValue(e.detail.value as string | null)}
        onZExpandedChange={(e) => setExpanded(e.detail.expandedValue)}
      />
      <span>Value: {value ?? 'null'} · Expanded: {expanded.join(', ') || 'none'}</span>
    </ZStack>
  );
}

```

### Case: declarative

#### React
```tsx
import { useState } from 'react';
import { ZButton, ZStack, ZTreeItem, ZTreeView } from '@zelviora/react';

/**
 * 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.
 */
export function TreeViewDeclarative() {
  const [value, setValue] = useState<string | null>('q1');
  const [drafts, setDrafts] = useState<string[]>([]);
  return (
    <ZStack className="demo-narrow">
      <ZStack orientation="horizontal" gap="sm" wrap>
        <ZButton variant="outline" tone="neutral" onClick={() => setDrafts((d) => [...d, `draft-${d.length + 1}`])}>Add draft</ZButton>
        <ZButton variant="outline" tone="neutral" disabled={!drafts.length} onClick={() => setDrafts((d) => d.slice(0, -1))}>Remove draft</ZButton>
      </ZStack>
      <ZTreeView
        label="Documents"
        value={value}
        defaultExpandedValue={['docs', 'reports']}
        onZSelectionChange={(e) => setValue(e.detail.value as string | null)}
      >
        <ZTreeItem value="docs" label="Documents">
          <ZTreeItem value="contracts" label="Contracts" />
          <ZTreeItem value="reports" label="Reports">
            <ZTreeItem value="q1" label="Q1" />
            <ZTreeItem value="q2" label="Q2" />
            <ZTreeItem value="q3" label="Q3 (locked)" disabled />
          </ZTreeItem>
          {drafts.map((d, i) => <ZTreeItem key={d} value={d} label={`Draft ${i + 1}`} />)}
        </ZTreeItem>
        <ZTreeItem value="inbox">
          <span slot="label"><strong>Inbox</strong> · 3 unread</span>
        </ZTreeItem>
      </ZTreeView>
      <span>Value: {value ?? 'null'}</span>
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { useState } from 'react';
import { ZStack, ZTreeView } from '@zelviora/react';
import { folders } from '../data.ts';

/** Three levels of folders, single selection, a disabled node (focusable, not selectable), three sizes. */
export function TreeViewDefault() {
  const [value, setValue] = useState<string | null>('q1');
  return (
    <ZStack className="demo-narrow">
      <ZTreeView label="Folders" items={folders} value={value} defaultExpandedValue={['docs', 'reports']} onZSelectionChange={(e) => setValue(e.detail.value as string | null)} />
      <span>Value: {value ?? 'null'}</span>
      <ZTreeView label="Folders (small)" size="sm" items={folders} />
      <ZTreeView label="Folders (large)" size="lg" items={folders} />
    </ZStack>
  );
}

```

### Case: lazy

#### React
```tsx
import { useState } from 'react';
import { ZStack, ZTreeView } from '@zelviora/react';
import { lazyRoots, loadRegions } from '../data.ts';

/** Children loaded on expand (fixed delay); "Archive" fails once: the error event fires, expanding again retries. */
export function TreeViewLazy() {
  const [log, setLog] = useState('');
  return (
    <ZStack className="demo-narrow">
      <ZTreeView label="Regions" items={lazyRoots} loadChildren={loadRegions} onZError={(e) => setLog(`zError: ${e.detail.node.label}`)} />
      <output>{log}</output>
      <ZTreeView label="Empty" items={[]} />
    </ZStack>
  );
}

```

### Case: virtual

#### React
```tsx
import { ZTreeView } from '@zelviora/react';
import { bigExpanded, bigTree } from '../data.ts';

/** 10 100 visible nodes: only the rows in view are rendered (virtual="auto" above 500 visible nodes). */
export function TreeViewVirtual() {
  return <ZTreeView className="demo-tree-frame" label="Large catalog" selectionMode="multiple" items={bigTree} defaultExpandedValue={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

#### React
```tsx
import { ZTreemapChart } from '@zelviora/react-chart';
import { bundleTree, bundleSeries } from '../data.ts';

export function TreemapChartBasic() {
  return (
    <ZTreemapChart
      heading="Workspace Bundle Size Breakdown (kB)"
      description="Hierarchical distribution of compiled asset sizes across packages."
      treeData={bundleTree} series={bundleSeries}
    />
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/react';
import { ZTreemapChart } from '@zelviora/react-chart';
import { bundleTree, bundleSeries } from '../data.ts';

export function TreemapChartControlled() {
  const [hidden, setHidden] = useState<string[]>([]);
  const [selected, setSelected] = useState<string>('Click any chart element to inspect');

  return (
    <ZStack gap="md">
      <ZStack orientation="horizontal" gap="sm" alignItems="center" wrap>
        <ZButton
          size="sm"
          variant="outline"
          onClick={() => setHidden([])}
        >
          Show All Series
        </ZButton>
        <ZBadge tone="primary" variant="soft">
          {selected}
        </ZBadge>
        <ZText variant="muted" size="sm">
          Hidden: {hidden.length ? hidden.join(', ') : 'none'}
        </ZText>
      </ZStack>
      <ZTreemapChart
        heading="Workspace Bundle Size Breakdown (kB) (Interactive)"
        description="Hierarchical distribution of compiled asset sizes across packages."
        treeData={bundleTree} series={bundleSeries}
        selectable
        hiddenSeries={hidden}
        onZSeriesToggle={(e) => setHidden(e.detail.hiddenSeries)}
        onZPointSelect={(e) =>
          setSelected(`Selected ${e.detail.seriesKey} (#${e.detail.index + 1})`)
        }
      />
    </ZStack>
  );
}

```

### Case: customization

#### React
```tsx
import { ZTreemapChart } from '@zelviora/react-chart';
import { bundleTree, bundleSeries } from '../data.ts';

export function TreemapChartCustomization() {
  return (
    <ZTreemapChart
      className="demo-chart-brand"
      description="Hierarchical distribution of compiled asset sizes across packages."
      valueFormat={{ maximumFractionDigits: 1 }}
      treeData={bundleTree} series={bundleSeries} roam="scale" renderer="canvas"
    >
      <span slot="heading">Workspace Bundle Size Breakdown (kB) — Custom Theme Tokens &amp; Canvas</span>
    </ZTreemapChart>
  );
}

```

### Case: states

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZTreemapChart } from '@zelviora/react-chart';
import { bundleTree, bundleSeries } from '../data.ts';

export function TreemapChartStates() {
  return (
    <ZStack gap="lg">
      <ZTreemapChart
        heading="Loading State (aria-busy)"
        loading
        treeData={bundleTree} series={bundleSeries}
      />
      <ZTreemapChart
        heading="Empty State"
        treeData={[]}
        series={bundleSeries}
      />
      <ZTreemapChart
        heading="Expanded Accessible Data Table"
        description="Hierarchical distribution of compiled asset sizes across packages."
        showDataTable
        treeData={bundleTree} series={bundleSeries}
      />
    </ZStack>
  );
}

```

### Case: variants

#### React
```tsx
import { ZStack } from '@zelviora/react';
import { ZTreemapChart } from '@zelviora/react-chart';
import { bundleTree, bundleSeries } from '../data.ts';

export function TreemapChartVariants() {
  return (
    <ZStack gap="lg">
      <ZTreemapChart
        heading="Interactive Roam & Breadcrumb"
        description="Interactive roam & breadcrumb trail vs static overview without breadcrumbs."
        treeData={bundleTree} series={bundleSeries} roam showBreadcrumb
      />
      <ZTreemapChart
        heading="Static Compact Treemap"
        description="Interactive roam & breadcrumb trail vs static overview without breadcrumbs."
        treeData={bundleTree} series={bundleSeries} showBreadcrumb={false}
      />
    </ZStack>
  );
}

```


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

#### React
```tsx
import { useRef, useState } from 'react';
import { ZButton, ZStack, ZText, ZVirtualList } from '@zelviora/react';
import { contactLabel, controlledDemo, initialRange, inRange, itemKey, valueStatus } from '../data.ts';

const { items } = controlledDemo;

/** The app holds the listbox `value` (`zSelect`) and scrolls from outside with `scrollToIndex` / `scrollToKey`. */
export function VirtualListControlled() {
  const list = useRef<HTMLZVirtualListElement>(null);
  const [value, setValue] = useState<string | undefined>(controlledDemo.value);
  const [range, setRange] = useState(initialRange);
  return (
    <ZStack gap="sm">
      <ZStack orientation="horizontal" gap="sm" wrap>
        <ZButton size="sm" variant="outline" tone="neutral" onClick={() => list.current?.scrollToIndex(0, { align: 'start' })}>{controlledDemo.first}</ZButton>
        <ZButton size="sm" variant="outline" tone="neutral" onClick={() => value && list.current?.scrollToKey(value, { align: 'center' })}>{controlledDemo.showSelected}</ZButton>
        <ZButton size="sm" variant="outline" tone="neutral" onClick={() => list.current?.scrollToIndex(items.length - 1, { align: 'end' })}>{controlledDemo.last}</ZButton>
        <ZButton size="sm" variant="outline" tone="neutral" onClick={() => setValue(controlledDemo.pick)}>{controlledDemo.select}</ZButton>
      </ZStack>
      <ZVirtualList
        ref={list}
        className="demo-virtual-list"
        listRole="listbox"
        label={controlledDemo.label}
        items={items}
        getItemKey={itemKey}
        formatLabel={contactLabel}
        value={value}
        onZSelect={(e) => setValue(e.detail.value)}
        onZRangeChange={(e) => setRange(e.detail)}
      >
        {inRange(items, range).map((c) => (
          <div key={c.key} slot={`item-${c.key}`} className="demo-virtual-row">{c.name}</div>
        ))}
      </ZVirtualList>
      <ZText variant="muted" size="sm">{valueStatus(value)}</ZText>
    </ZStack>
  );
}

```

### Case: default

#### React
```tsx
import { useState } from 'react';
import { ZVirtualList } from '@zelviora/react';
import { defaultDemo, initialRange, inRange, itemKey } from '../data.ts';

/**
 * 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), so app CSS and React components apply.
 */
export function VirtualListDefault() {
  const [range, setRange] = useState(initialRange);
  return (
    <ZVirtualList
      className="demo-virtual-list"
      label={defaultDemo.label}
      items={defaultDemo.items}
      getItemKey={itemKey}
      onZRangeChange={(e) => setRange(e.detail)}
    >
      {inRange(defaultDemo.items, range).map((c) => (
        <div key={c.key} slot={`item-${c.key}`} className="demo-virtual-row">{defaultDemo.row(c)}</div>
      ))}
    </ZVirtualList>
  );
}

```

### Case: grouped

#### React
```tsx
import { useState } from 'react';
import { ZVirtualList } from '@zelviora/react';
import { groupedDemo, initialRange, inRange, itemKey } from '../data.ts';

/** A–Z directory: `groups` (data, sorted by `start`) render sticky group headers labelled by their letter. */
export function VirtualListGrouped() {
  const [range, setRange] = useState(initialRange);
  return (
    <ZVirtualList
      className="demo-virtual-list"
      label={groupedDemo.label}
      items={groupedDemo.items}
      groups={groupedDemo.groups}
      getItemKey={itemKey}
      onZRangeChange={(e) => setRange(e.detail)}
    >
      {inRange(groupedDemo.items, range).map((c) => (
        <div key={c.key} slot={`item-${c.key}`} className="demo-virtual-row">{c.name}</div>
      ))}
    </ZVirtualList>
  );
}

```

### Case: load-more

#### React
```tsx
import { useEffect, useRef, useState } from 'react';
import { ZSpinner, ZText, ZVirtualList } from '@zelviora/react';
import { initialRange, inRange, itemKey, loadMoreDemo, makePosts, nextPage, type Post } from '../data.ts';

/** Infinite loading: `loadMore` while data remains, `zLoadMore` near the end, `loading` while the next page arrives. */
export function VirtualListLoadMore() {
  const [items, setItems] = useState<Post[]>(() => makePosts(loadMoreDemo.page));
  const [loading, setLoading] = useState(false);
  const [range, setRange] = useState(initialRange);
  const timer = useRef<ReturnType<typeof setTimeout>>(undefined);
  useEffect(() => () => clearTimeout(timer.current), []);
  const more = () => {
    setLoading(true);
    timer.current = setTimeout(() => {
      setItems(nextPage);
      setLoading(false);
    }, loadMoreDemo.delay);
  };
  return (
    <ZVirtualList
      className="demo-virtual-list"
      label={loadMoreDemo.label}
      items={items}
      getItemKey={itemKey}
      loadMore={items.length < loadMoreDemo.total}
      loading={loading}
      onZLoadMore={more}
      onZRangeChange={(e) => setRange(e.detail)}
    >
      {inRange(items, range).map((p) => (
        <div key={p.key} slot={`item-${p.key}`} className="demo-virtual-row">{p.title}</div>
      ))}
      <ZSpinner slot="loading" label={loadMoreDemo.loading} />
      <ZText slot="empty" variant="muted">{loadMoreDemo.empty}</ZText>
    </ZVirtualList>
  );
}

```

### Case: variants

#### React
```tsx
import { useState } from 'react';
import { ZGrid, ZStack, ZText, ZVirtualList } from '@zelviora/react';
import { contactLabel, initialRange, inRange, itemKey, postLabel, variantsDemo } from '../data.ts';

const { feed, listbox } = variantsDemo;

/** `listRole` feed (APG Feed: PageDown / PageUp move between articles) and listbox (single selection, typeahead). */
export function VirtualListVariants() {
  const [feedRange, setFeedRange] = useState(feed.initialRange);
  const [boxRange, setBoxRange] = useState(initialRange);
  return (
    <ZGrid columns="1 sm:2" gap="lg">
      <ZVirtualList
        className="demo-virtual-list"
        listRole="feed"
        dynamicSize
        label={feed.label}
        items={feed.items}
        getItemKey={itemKey}
        formatLabel={postLabel}
        onZRangeChange={(e) => setFeedRange(e.detail)}
      >
        {inRange(feed.items, feedRange).map((p) => (
          <div key={p.key} slot={`item-${p.key}`} className="demo-virtual-row">
            <ZStack gap="xs">
              <ZText variant="strong" data-z-item-label="">{p.title}</ZText>
              <ZText variant="muted" size="sm" data-z-item-description="">{p.body}</ZText>
            </ZStack>
          </div>
        ))}
      </ZVirtualList>
      <ZVirtualList
        className="demo-virtual-list"
        listRole="listbox"
        label={listbox.label}
        items={listbox.items}
        getItemKey={itemKey}
        formatLabel={contactLabel}
        onZRangeChange={(e) => setBoxRange(e.detail)}
      >
        {inRange(listbox.items, boxRange).map((c) => (
          <div key={c.key} slot={`item-${c.key}`} className="demo-virtual-row">{c.name}</div>
        ))}
      </ZVirtualList>
    </ZGrid>
  );
}

```


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

#### React
```tsx
import { ZCard, ZWatermark } from '@zelviora/react';

export function WatermarkBasic() {
  return (
    <ZWatermark text="Confidential">
      <ZCard 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>
      </ZCard>
    </ZWatermark>
  );
}

```

### Case: controlled

#### React
```tsx
import { useState } from 'react';
import { ZCard, ZInput, ZStack, ZWatermark } from '@zelviora/react';

// The app formats the date for the locale.
const today = new Intl.DateTimeFormat('en-US', { dateStyle: 'short' }).format(new Date());

export function WatermarkControlled() {
  const [user, setUser] = useState('anna.lee');
  return (
    <ZStack gap="sm">
      <ZInput className="demo-narrow" label="User" value={user} onZInput={(e) => setUser(e.detail.value)} />
      <ZWatermark text={[user || '—', today]}>
        <ZCard heading="Payroll"><p>The watermark follows the user name.</p><p>October payroll.</p></ZCard>
      </ZWatermark>
    </ZStack>
  );
}

```

### Case: form

#### React
```tsx
import { ZButton, ZField, ZInput, ZStack, ZWatermark } from '@zelviora/react';

export function WatermarkForm() {
  return (
    <ZWatermark text="Draft">
      <form className="demo-narrow">
        <ZStack>
          <ZField label="Title">
            <ZInput name="title" />
          </ZField>
          <ZField label="Amount">
            <ZInput name="amount" />
          </ZField>
          <ZButton type="button">Save draft</ZButton>
        </ZStack>
      </form>
    </ZWatermark>
  );
}

```

### Case: protect

#### React
```tsx
import { useState } from 'react';
import { ZCard, ZStack, ZWatermark } from '@zelviora/react';

export function WatermarkProtect() {
  const [log, setLog] = useState<string[]>([]);
  return (
    <ZStack gap="sm">
      <ZWatermark protect text="Internal use only" onZTamper={(e) => setLog((l) => [...l, e.detail.reason])}>
        <ZCard heading="Protected">
          <p>Remove the layer in DevTools: it comes back and zTamper fires. This deters, it does not secure.</p>
        </ZCard>
      </ZWatermark>
      <span>Tamper events: {log.length ? log.join(', ') : 'none'}</span>
    </ZStack>
  );
}

```

### Case: table

#### React
```tsx
import { ZTable, ZWatermark } from '@zelviora/react';

const columns = [
  { key: 'name', header: 'Employee' },
  { key: 'salary', header: 'Salary', format: { type: 'currency' as const, currency: 'USD' } },
];
const rows = [
  { key: '1', name: 'Anna Lee', salary: 85000 },
  { key: '2', name: 'Mark Tran', salary: 102000 },
  { key: '3', name: 'Carlos Diaz', salary: 64500 },
];

export function WatermarkTable() {
  return (
    <ZWatermark text="Confidential – HR" className="demo-watermark-brand">
      <ZTable caption="Salaries" rowHeader="name" columns={columns} rows={rows} />
    </ZWatermark>
  );
}

```

### Case: variants

#### React
```tsx
import { ZCard, ZGrid, ZWatermark } from '@zelviora/react';

// An image must be a data URL (or a Blob loaded by the app): the watermark never fetches.
const 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";

export function WatermarkVariants() {
  return (
    <ZGrid columns="1 md:2" gap="md">
      <ZWatermark text={['Confidential', 'anna.lee', '05/10/2026']} rotate={-30} tileGap={[60, 60]}>
        <ZCard heading="Several lines"><p>Name, user and date on each tile.</p><p>Rotated by -30°.</p></ZCard>
      </ZWatermark>
      <ZWatermark image={logo}>
        <ZCard heading="Image"><p>An embedded logo repeated over the content.</p><p>No network request.</p></ZCard>
      </ZWatermark>
    </ZGrid>
  );
}

```

