# Zelviora Component Library — LLM Documentation (Vue)

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

#### Vue
```vue
<script setup lang="ts">
import { ZAccordion, ZAccordionContent, ZAccordionItem, ZAccordionTrigger } from '@zelviora/vue';
</script>

<template>
  <ZAccordion default-value="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>
</template>

```

### Case: multiple

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZAccordion, ZAccordionContent, ZAccordionItem, ZAccordionTrigger, ZStack } from '@zelviora/vue';

const open = ref<string[]>(['general']);
</script>

<template>
  <ZStack>
    <ZAccordion v-model="open" multiple variant="outline">
      <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>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZAffix, ZButton, ZCard, ZStack, ZText } from '@zelviora/vue';
</script>

<template>
  <div class="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 class="demo-long"></div>
    </ZStack>
  </div>
</template>

```

### Case: bottom

#### Vue
```vue
<script setup lang="ts">
import { ZAffix, ZButton, ZCard, ZStack } from '@zelviora/vue';
</script>

<template>
  <div class="demo-scroll-frame">
    <ZStack gap="md">
      <div class="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>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZAffix, ZCard, ZStack, ZText } from '@zelviora/vue';
</script>

<template>
  <div class="demo-scroll-frame">
    <ZStack gap="md">
      <ZText>Scroll down to see the shadow.</ZText>
      <ZAffix class="demo-affix-shadow">
        <ZCard size="sm"><ZText>Table of contents</ZText></ZCard>
      </ZAffix>
      <div class="demo-long"></div>
    </ZStack>
  </div>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZAlert } from '@zelviora/vue';
</script>

<template>
  <ZAlert heading="Scheduled maintenance">The service will be unavailable on Sunday from 1:00 to 3:00.</ZAlert>
</template>

```

### Case: dismissible

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZAlert, ZButton, ZStack } from '@zelviora/vue';

const open = ref(true);

function onOpenChange(e: CustomEvent<{ open: boolean; reason: string }>) {
  open.value = e.detail.open;
}
</script>

<template>
  <ZStack gap="md" align-items="start">
    <ZAlert tone="info" dismissible :open="open" @z-open-change="onOpenChange">
      A new version is available.
      <ZButton slot="actions" size="sm" variant="outline" tone="neutral">Update now</ZButton>
    </ZAlert>
    <ZButton v-if="!open" variant="link" @click="open = true">Show the alert again</ZButton>
  </ZStack>
</template>

```

### Case: live

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZAlert, ZButton, ZStack } from '@zelviora/vue';

const error = ref(false);
</script>

<template>
  <ZStack gap="md" align-items="start">
    <ZButton @click="error = true">Upload file</ZButton>
    <ZAlert v-if="error" tone="destructive" live="assertive" heading="Upload failed">The file is larger than 10 MB.</ZAlert>
  </ZStack>
</template>

```

### Case: tones

#### Vue
```vue
<script setup lang="ts">
import { ZAlert, ZStack } from '@zelviora/vue';
</script>

<template>
  <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>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZAlertDialog, ZButton } from '@zelviora/vue';

// Keeps the dialog open while a (fake) request runs: preventDefault() on confirm, then close from the ref.
const open = ref(false);
const loading = ref(false);

function onOpenChange(e: CustomEvent<{ open: boolean; reason: string }>) {
  open.value = e.detail.open;
}

function onConfirm(e: CustomEvent) {
  e.preventDefault();
  loading.value = true;
  setTimeout(() => {
    loading.value = false;
    open.value = false;
  }, 1000);
}
</script>

<template>
  <ZAlertDialog
    heading="Leave the workspace?"
    description="You lose access to its projects until an owner invites you again."
    tone="warning"
    action-label="Leave"
    :open="open"
    :action-loading="loading"
    @z-open-change="onOpenChange"
    @z-confirm="onConfirm"
    @z-cancel="loading = false"
  >
    <ZButton slot="trigger" variant="outline" tone="warning">Leave workspace</ZButton>
  </ZAlertDialog>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZAlertDialog, ZButton, ZStack } from '@zelviora/vue';

const result = ref('none yet');

function onCancel(e: CustomEvent<{ reason: string }>) {
  result.value = `kept (${e.detail.reason})`;
}
</script>

<template>
  <ZStack gap="sm">
    <ZAlertDialog
      heading="Delete project?"
      description="The project and its 24 files are deleted permanently. This cannot be undone."
      action-label="Delete"
      @z-confirm="result = 'deleted'"
      @z-cancel="onCancel"
    >
      <ZButton slot="trigger" tone="destructive">Delete project</ZButton>
    </ZAlertDialog>
    <span>Result: {{ result }}</span>
  </ZStack>
</template>

```

### Case: imperative

#### Vue
```vue
<script setup lang="ts">
// confirm() opens an alert dialog from code and resolves true (confirmed) or false (cancelled / Escape).
import { ref } from 'vue';
import { ZButton, ZStack, confirm } from '@zelviora/vue';

const result = ref('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',
  });
  result.value = ok ? 'Deleted' : 'Kept';
}
</script>

<template>
  <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
    <ZButton tone="destructive" @click="remove">Delete project</ZButton>
    <span role="status">{{ result }}</span>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZAnchor, ZAnchorLink, ZHeading, ZStack, ZText } from '@zelviora/vue';

// Five sections in a scroll container (`target`); the link of the section being read is marked while scrolling.
const parts = ['Overview', 'Install', 'Usage', 'Theming', 'FAQ'];
const scroller = ref<HTMLElement | null>(null);
const last = ref('');

function onChange(e: CustomEvent<{ value: string | null; reason: string }>) {
  last.value = `${e.detail.value} (${e.detail.reason})`;
}
</script>

<template>
  <ZStack gap="sm">
    <ZStack orientation="horizontal" gap="md">
      <ZAnchor class="demo-anchor-toc" :target="scroller ?? undefined" @z-change="onChange">
        <ZAnchorLink v-for="p in parts" :key="p" :href="`#vue-anchor-${p.toLowerCase()}`">{{ p }}</ZAnchorLink>
      </ZAnchor>
      <div ref="scroller" class="demo-anchor-scroll" tabindex="0">
        <section v-for="p in parts" :id="`vue-anchor-${p.toLowerCase()}`" :key="p" class="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>
</template>

```

### Case: nested

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZAnchor, ZAnchorLink, ZHeading, ZStack, ZText } from '@zelviora/vue';

// Two levels (`sub` slot), long labels, smooth scrolling and an `offset` for the sticky header of the container.
const scroller = ref<HTMLElement | null>(null);
</script>

<template>
  <ZStack orientation="horizontal" gap="md">
    <ZAnchor class="demo-anchor-toc" label="Guide" :target="scroller ?? undefined" :offset="48" smooth>
      <ZAnchorLink href="#vue-guide-start">Getting started</ZAnchorLink>
      <ZAnchorLink href="#vue-guide-config">
        Configuration
        <ZAnchorLink slot="sub" href="#vue-guide-tokens">Design tokens and brand themes for every product</ZAnchorLink>
        <ZAnchorLink slot="sub" href="#vue-guide-locale">Locale</ZAnchorLink>
      </ZAnchorLink>
      <ZAnchorLink href="#vue-guide-deploy">Deploy</ZAnchorLink>
    </ZAnchor>
    <div ref="scroller" class="demo-anchor-scroll" tabindex="0">
      <div class="demo-anchor-sticky"><ZText>Sticky header (offset 48)</ZText></div>
      <section id="vue-guide-start" class="demo-anchor-section"><ZHeading :level="3">Getting started</ZHeading></section>
      <section id="vue-guide-config" class="demo-anchor-section"><ZHeading :level="3">Configuration</ZHeading></section>
      <section id="vue-guide-tokens" class="demo-anchor-section"><ZHeading :level="4">Design tokens</ZHeading></section>
      <section id="vue-guide-locale" class="demo-anchor-section"><ZHeading :level="4">Locale</ZHeading></section>
      <section id="vue-guide-deploy" class="demo-anchor-section"><ZHeading :level="3">Deploy</ZHeading></section>
    </div>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZAppShell, ZIcon, ZSegmented, ZSegmentedItem, ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack, ZText } from '@zelviora/vue';
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.
const mode = ref<'icon' | 'offcanvas'>('icon');
</script>

<template>
  <ZStack gap="sm">
    <ZSegmented v-model="mode" :label="texts.collapseModeLabel">
      <ZSegmentedItem value="icon">Icon</ZSegmentedItem>
      <ZSegmentedItem value="offcanvas">Offcanvas</ZSegmentedItem>
    </ZSegmented>
    <div class="demo-app-shell-scroll">
      <ZAppShell class="demo-app-shell-frame demo-app-shell-wide" breakpoint="sm" side="end" :collapse-mode="mode" disable-sticky-header>
        <ZText slot="header" variant="strong">{{ docsTitle }}</ZText>
        <ZSidebar slot="nav" :label="docsNavLabel">
          <ZSidebarGroup :label="sectionsLabel">
            <ZSidebarItem v-for="(item, i) in sectionItems" :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>
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZAppShell, ZButton, ZIcon, ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack, ZText } from '@zelviora/vue';
import { itemHref, navLabel, shellTitle, texts, workspaceItems, workspaceLabel } from '../data.ts';

// The app holds `navCollapsed` (wide mode): v-model binds it through `zCollapseChange` (no `hotkey`, so no shortcut).
const navCollapsed = ref(false);
</script>

<template>
  <ZStack gap="sm">
    <ZStack orientation="horizontal" align-items="center" gap="sm">
      <ZButton size="sm" variant="outline" tone="neutral" @click="navCollapsed = !navCollapsed">
        {{ navCollapsed ? texts.expand : texts.collapse }}
      </ZButton>
      <ZText variant="muted" size="sm">navCollapsed = {{ String(navCollapsed) }}</ZText>
    </ZStack>
    <div class="demo-app-shell-scroll">
      <ZAppShell v-model="navCollapsed" class="demo-app-shell-frame demo-app-shell-wide" breakpoint="sm" disable-sticky-header>
        <ZText slot="header" variant="strong">{{ shellTitle }}</ZText>
        <ZSidebar slot="nav" :label="navLabel">
          <ZSidebarGroup :label="workspaceLabel">
            <ZSidebarItem v-for="(item, i) in workspaceItems" :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>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ZAppShell, ZBadge, ZIcon, ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack, ZText } from '@zelviora/vue';
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.
</script>

<template>
  <div class="demo-app-shell-scroll">
    <ZAppShell class="demo-app-shell-frame demo-app-shell-wide" breakpoint="sm" nav-label="Main" hotkey="Mod+B">
      <ZText slot="header" variant="strong">{{ shellTitle }}</ZText>
      <ZSidebar slot="nav" :label="navLabel">
        <ZSidebarGroup :label="workspaceLabel">
          <ZSidebarItem v-for="(item, i) in workspaceItems" :key="item.value" :href="itemHref('default', item.value)" :current="i === 0">
            <ZIcon slot="icon" :name="item.icon" />
            {{ item.label }}
            <ZBadge v-if="item.badge" slot="end">{{ item.badge }}</ZBadge>
          </ZSidebarItem>
        </ZSidebarGroup>
      </ZSidebar>
      <ZStack gap="sm">
        <ZText variant="strong">{{ recentOrdersTitle }}</ZText>
        <ZText v-for="o in recentOrders" :key="o.id">{{ orderLine(o) }}</ZText>
      </ZStack>
      <ZText slot="footer" variant="muted" size="sm">{{ footer }}</ZText>
    </ZAppShell>
  </div>
</template>

```

### Case: narrow

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZAppShell, ZButton, ZIcon, ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack, ZText } from '@zelviora/vue';
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`.
const navOpen = ref(false);
const mode = ref('-');
const reason = ref('-');

function onOpen(e: CustomEvent<{ navOpen: boolean; reason: string }>) {
  navOpen.value = e.detail.navOpen;
  reason.value = e.detail.reason;
}
function onMode(e: CustomEvent<{ mode: string }>) {
  mode.value = e.detail.mode;
}
</script>

<template>
  <ZAppShell class="demo-app-shell-frame" breakpoint="xl" :nav-open="navOpen" @z-open-change="onOpen" @z-mode-change="onMode">
    <ZText slot="header" variant="strong">{{ texts.narrowTitle }}</ZText>
    <ZSidebar slot="nav" :label="navLabel">
      <ZSidebarGroup :label="workspaceLabel">
        <ZSidebarItem v-for="(item, i) in narrowItems" :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" align-items="start">
      <ZButton size="sm" variant="outline" tone="neutral" :disabled="mode !== 'narrow'" @click="navOpen = true">{{ texts.openNav }}</ZButton>
      <ZText variant="muted" size="sm">mode = {{ mode }}, navOpen = {{ String(navOpen) }}, last reason = {{ reason }}</ZText>
    </ZStack>
  </ZAppShell>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZAreaChart } from '@zelviora/vue-chart';
import { bandwidthData, bandwidthSeries } from '../data.ts';
</script>

<template>
  <ZAreaChart
    heading="Cluster Network Throughput (Gbps)"
    description="Inbound and outbound traffic volume sampled across six intervals."
    x-key="window" :data="bandwidthData" :series="bandwidthSeries"
  />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/vue';
import {
  ZAreaChart,
  type ChartPointSelectDetail,
  type ChartSeriesToggleDetail,
} from '@zelviora/vue-chart';
import { bandwidthData, bandwidthSeries } from '../data.ts';

const hidden = ref<string[]>([]);
const selected = ref('Click any chart element to inspect');

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

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

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" gap="sm" align-items="center" wrap>
      <ZButton size="sm" variant="outline" @click="hidden = []">
        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."
      x-key="window" :data="bandwidthData" :series="bandwidthSeries"
      selectable
      :hidden-series="hidden"
      @z-series-toggle="onToggle"
      @z-point-select="onSelect"
    />
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZAreaChart } from '@zelviora/vue-chart';
import { bandwidthData, bandwidthSeries } from '../data.ts';
</script>

<template>
  <ZAreaChart
    class="demo-chart-brand"
    description="Inbound and outbound traffic volume sampled across six intervals."
    :value-format="{ maximumFractionDigits: 1 }"
    x-key="window" :data="bandwidthData" :series="bandwidthSeries" stacked data-zoom :area-opacity="0.28" renderer="canvas"
  >
    <span slot="heading">Cluster Network Throughput (Gbps) — Custom Theme Tokens &amp; Canvas</span>
  </ZAreaChart>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZAreaChart } from '@zelviora/vue-chart';
import { bandwidthData, bandwidthSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZAreaChart
      heading="Loading State (aria-busy)"
      loading
      x-key="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."
      show-data-table
      x-key="window" :data="bandwidthData" :series="bandwidthSeries"
    />
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZAreaChart } from '@zelviora/vue-chart';
import { bandwidthData, bandwidthSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZAreaChart
      heading="Stacked Cumulative Area"
      description="Stacked cumulative area chart with higher fill opacity vs unstacked clean area without symbols."
      x-key="window" :data="bandwidthData" :series="bandwidthSeries" stacked smooth :area-opacity="0.35"
    />
    <ZAreaChart
      heading="Subtle Unstacked Fill"
      description="Stacked cumulative area chart with higher fill opacity vs unstacked clean area without symbols."
      x-key="window" :data="bandwidthData" :series="bandwidthSeries" :area-opacity="0.12" :show-symbol="false"
    />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZAspectRatio } from '@zelviora/vue';
</script>

<template>
  <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>
</template>

```

### Case: composition

#### Vue
```vue
<script setup lang="ts">
import { ZAspectRatio, ZCard } from '@zelviora/vue';
</script>

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

```

### Case: fit

#### Vue
```vue
<script setup lang="ts">
import { ZAspectRatio, ZGrid } from '@zelviora/vue';
</script>

<template>
  <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>
</template>

```

### Case: ratios

#### Vue
```vue
<script setup lang="ts">
import { ZAspectRatio, ZGrid } from '@zelviora/vue';
</script>

<template>
  <ZGrid columns="2" gap="md">
    <ZAspectRatio ratio="1/1"><div class="demo-media">1/1</div></ZAspectRatio>
    <ZAspectRatio ratio="4:3"><div class="demo-media">4:3</div></ZAspectRatio>
    <ZAspectRatio ratio="21/9"><div class="demo-media">21/9</div></ZAspectRatio>
    <ZAspectRatio ratio="1.5"><div class="demo-media">1.5</div></ZAspectRatio>
  </ZGrid>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { computed, ref } from 'vue';
import { ZAutocomplete, ZStack } from '@zelviora/vue';

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

// Free text with suggestions computed from the typed text: the value is the text (v-model binds `value` through zInput).
const email = ref('');
const options = computed(() => {
  const local = email.value.split('@')[0] ?? '';
  return local ? DOMAINS.map((d) => ({ value: `${local}@${d}`, label: `${local}@${d}` })) : [];
});
</script>

<template>
  <ZStack class="demo-narrow">
    <ZAutocomplete v-model="email" label="Email" type="email" placeholder="name@example.com" clearable :options="options" />
    <span>Value: {{ email || '(empty)' }}</span>
  </ZStack>
</template>

```

### Case: form

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZAutocomplete, ZButton, ZField, ZSelectOption, ZStack } from '@zelviora/vue';

// Native form: the text is submitted; required email inside a field (a bad address shows typeMismatch); reset.
const sent = ref('');

function submit(e: Event) {
  sent.value = JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]);
}
</script>

<template>
  <form class="demo-narrow" @submit.prevent="submit">
    <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" value="Helsinki">
        <ZSelectOption value="Boston">Boston</ZSelectOption>
        <ZSelectOption value="Helsinki">Helsinki</ZSelectOption>
        <ZSelectOption value="Seattle">Seattle</ZSelectOption>
      </ZAutocomplete>
      <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
        <ZButton type="submit">Submit</ZButton>
        <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
      </ZStack>
      <output v-if="sent">{{ sent }}</output>
    </ZStack>
  </form>
</template>

```

### Case: history

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZAutocomplete, ZStack } from '@zelviora/vue';

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.
const query = ref('');
const submitted = ref('');

function onChange(e: CustomEvent<{ value: string }>) {
  submitted.value = e.detail.value;
}
</script>

<template>
  <ZStack class="demo-narrow">
    <ZAutocomplete v-model="query" label="Search" type="search" clearable :min-chars="0" :options="HISTORY" @z-change="onChange" />
    <span>Last committed search: {{ submitted || '(none)' }}</span>
  </ZStack>
</template>

```

### Case: i18n

#### Vue
```vue
<script setup lang="ts">
import { ZAutocomplete, ZConfigProvider, ZSelectOption } from '@zelviora/vue';

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.
</script>

<template>
  <ZConfigProvider locale="vi">
    <div class="demo-narrow">
      <ZAutocomplete label="Điểm đến" hint='Gõ "h" hoặc "đà"' inline-complete>
        <ZSelectOption v-for="p in PLACES" :key="p" :value="p">{{ p }}</ZSelectOption>
      </ZAutocomplete>
    </div>
  </ZConfigProvider>
</template>

```

### Case: inline

#### Vue
```vue
<script setup lang="ts">
import { ZAutocomplete, ZSelectOption, ZStack } from '@zelviora/vue';

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.
</script>

<template>
  <ZStack class="demo-narrow">
    <ZAutocomplete label="Destination" hint='Type "h" or "da"' inline-complete>
      <ZSelectOption v-for="p in PLACES" :key="p" :value="p">{{ p }}</ZSelectOption>
    </ZAutocomplete>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZAvatar, ZStack } from '@zelviora/vue';

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

<template>
  <ZStack orientation="horizontal" align-items="center" gap="md">
    <ZAvatar :src="PHOTO" name="Anna Lee" />
    <ZAvatar name="Mark Tran" />
  </ZStack>
</template>

```

### Case: fallback

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZAvatar, ZIcon, ZStack, ZText } from '@zelviora/vue';

const BROKEN = 'data:image/png;base64,AAAA';
const status = ref('loading…');
</script>

<template>
  <ZStack gap="sm">
    <ZStack orientation="horizontal" align-items="center" gap="md" wrap>
      <ZAvatar :src="BROKEN" name="Daniel Hughes" @z-error="status = 'image failed, initials shown'" @z-load="status = '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>
</template>

```

### Case: group

#### Vue
```vue
<script setup lang="ts">
import { ZAvatar, ZAvatarGroup, ZBadge, ZStack } from '@zelviora/vue';

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

<template>
  <ZStack orientation="horizontal" align-items="center" gap="lg" wrap>
    <ZAvatarGroup :max="3" label="Project team">
      <ZAvatar v-for="name in team" :key="name" :name="name" tone="auto" />
    </ZAvatarGroup>
    <ZBadge mode="overlay" dot tone="success" label="Online">
      <ZAvatar name="Anna Lee" size="lg" />
    </ZBadge>
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZAvatar, ZStack } from '@zelviora/vue';

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'];
</script>

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" align-items="center" gap="sm">
      <ZAvatar v-for="size in sizes" :key="size" :size="size" :name="`Size ${size.toUpperCase()}`" />
    </ZStack>
    <ZStack orientation="horizontal" align-items="center" gap="sm">
      <ZAvatar shape="circle" name="Circle Shape" tone="primary" />
      <ZAvatar shape="square" name="Square Shape" tone="primary" />
    </ZStack>
    <ZStack orientation="horizontal" align-items="center" gap="sm" wrap>
      <ZAvatar v-for="tone in tones" :key="tone" :tone="tone" :name="`${tone} tone`" />
    </ZStack>
    <ZStack orientation="horizontal" align-items="center" gap="sm">
      <ZAvatar v-for="name in people" :key="name" tone="auto" :name="name" />
    </ZStack>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZBackTop, ZLink, ZStack, ZText } from '@zelviora/vue';
</script>

<template>
  <div class="demo-fixed-frame">
    <div id="back-top-basic-vue" class="demo-scroll-frame">
      <ZStack gap="md" class="demo-long">
        <ZLink href="#back-top-basic-vue">First link</ZLink>
        <ZText>Scroll this area down.</ZText>
      </ZStack>
    </div>
    <ZBackTop target="#back-top-basic-vue" :visibilityHeight="120"></ZBackTop>
  </div>
</template>

```

### Case: custom

#### Vue
```vue
<script setup lang="ts">
import { ZBackTop, ZButton, ZIcon, ZStack, ZText } from '@zelviora/vue';
</script>

<template>
  <div class="demo-fixed-frame">
    <div id="back-top-custom-vue" class="demo-scroll-frame">
      <ZStack gap="md" class="demo-long">
        <ZButton id="back-top-custom-start-vue" variant="link">Start of the list</ZButton>
        <ZText>Scroll this area down.</ZText>
      </ZStack>
    </div>
    <ZBackTop target="#back-top-custom-vue" :visibilityHeight="120" label="Back to the start of the list" initialFocus="#back-top-custom-start-vue"><ZIcon slot="icon" name="vertical_align_top" /></ZBackTop>
  </div>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZBadge } from '@zelviora/vue';
</script>

<template>
  <ZBadge>New</ZBadge>
</template>

```

### Case: overlay

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZButton, ZStack } from '@zelviora/vue';

const count = ref(5);
</script>

<template>
  <ZStack orientation="horizontal" align-items="center" gap="lg" wrap>
    <ZBadge mode="overlay" variant="solid" tone="destructive" :count="count" :max="99" label="{count} unread notifications">
      <ZButton variant="outline" tone="neutral" @click="count += 50">Notifications</ZButton>
    </ZBadge>
    <ZBadge mode="overlay" variant="solid" tone="primary" dot label="New activity">
      <ZButton variant="outline" tone="neutral">Activity</ZButton>
    </ZBadge>
  </ZStack>
</template>

```

### Case: tones

#### Vue
```vue
<script setup lang="ts">
import { ZBadge, ZStack } from '@zelviora/vue';

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

<template>
  <ZStack gap="md">
    <ZStack v-for="variant in variants" :key="variant" orientation="horizontal" wrap gap="sm">
      <ZBadge v-for="tone in tones" :key="tone" :tone="tone" :variant="variant">{{ tone }}</ZBadge>
    </ZStack>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZBanner } from '@zelviora/vue';
</script>

<template>
  <ZBanner>Scheduled maintenance on Sunday from 1:00 to 3:00.</ZBanner>
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBanner, ZButton, ZStack } from '@zelviora/vue';

const open = ref(true);

function onOpenChange(e: CustomEvent<{ open: boolean }>) {
  open.value = e.detail.open;
}
</script>

<template>
  <ZStack gap="md" align-items="start">
    <ZBanner tone="primary" dismissible :open="open" @z-open-change="onOpenChange">
      Try the new dashboard.
      <ZButton slot="actions" size="sm" variant="outline" tone="neutral">Open it</ZButton>
    </ZBanner>
    <ZButton v-if="!open" variant="link" @click="open = true">Show the banner again</ZButton>
  </ZStack>
</template>

```

### Case: sticky

#### Vue
```vue
<script setup lang="ts">
import { ZBanner, ZStack, ZText } from '@zelviora/vue';
</script>

<template>
  <div class="demo-scroll-frame">
    <ZBanner :sticky="true" tone="warning" label="Maintenance">Maintenance tonight at 22:00.</ZBanner>
    <ZStack gap="md" class="demo-long">
      <ZText>Scroll this area: the banner stays at the top.</ZText>
    </ZStack>
  </div>
</template>

```

### Case: tones

#### Vue
```vue
<script setup lang="ts">
import { ZBanner, ZButton, ZStack } from '@zelviora/vue';
</script>

<template>
  <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>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZBarChart } from '@zelviora/vue-chart';
import { revenueData, revenueSeries } from '../data.ts';
</script>

<template>
  <ZBarChart
    heading="Quarterly Cloud Infrastructure Revenue (Million USD)"
    description="Revenue comparison between 2024 and 2025 across four fiscal quarters."
    x-key="quarter" :data="revenueData" :series="revenueSeries"
  />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/vue';
import {
  ZBarChart,
  type ChartPointSelectDetail,
  type ChartSeriesToggleDetail,
} from '@zelviora/vue-chart';
import { revenueData, revenueSeries } from '../data.ts';

const hidden = ref<string[]>([]);
const selected = ref('Click any chart element to inspect');

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

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

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" gap="sm" align-items="center" wrap>
      <ZButton size="sm" variant="outline" @click="hidden = []">
        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."
      x-key="quarter" :data="revenueData" :series="revenueSeries"
      selectable
      :hidden-series="hidden"
      @z-series-toggle="onToggle"
      @z-point-select="onSelect"
    />
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZBarChart } from '@zelviora/vue-chart';
import { revenueData, revenueSeries } from '../data.ts';
</script>

<template>
  <ZBarChart
    class="demo-chart-brand"
    description="Revenue comparison between 2024 and 2025 across four fiscal quarters."
    :value-format="{ maximumFractionDigits: 1 }"
    x-key="quarter" :data="revenueData" :series="revenueSeries" data-zoom :border-radius="6" renderer="canvas"
  >
    <span slot="heading">Quarterly Cloud Infrastructure Revenue (Million USD) — Custom Theme Tokens &amp; Canvas</span>
  </ZBarChart>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZBarChart } from '@zelviora/vue-chart';
import { revenueData, revenueSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZBarChart
      heading="Loading State (aria-busy)"
      loading
      x-key="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."
      show-data-table
      x-key="quarter" :data="revenueData" :series="revenueSeries"
    />
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZBarChart } from '@zelviora/vue-chart';
import { revenueData, revenueSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZBarChart
      heading="Horizontal Bar Layout"
      description="Horizontal bar layout with rounded corners alongside stacked vertical bars."
      x-key="quarter" :data="revenueData" :series="revenueSeries" orientation="horizontal" :border-radius="6"
    />
    <ZBarChart
      heading="Stacked Vertical Bars"
      description="Horizontal bar layout with rounded corners alongside stacked vertical bars."
      x-key="quarter" :data="revenueData" :series="revenueSeries" stacked :bar-max-width="36" :border-radius="4"
    />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZBoxplotChart } from '@zelviora/vue-chart';
import { boxplotData, boxplotSeries } from '../data.ts';
</script>

<template>
  <ZBoxplotChart
    heading="Service Latency Quartile Distribution (ms)"
    description="Five-number latency distribution across Gateway, Auth, Search, and Billing services."
    x-key="service" min-key="min" q1-key="q1" median-key="median" q3-key="q3" max-key="max" :data="boxplotData" :series="boxplotSeries"
  />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/vue';
import {
  ZBoxplotChart,
  type ChartPointSelectDetail,
  type ChartSeriesToggleDetail,
} from '@zelviora/vue-chart';
import { boxplotData, boxplotSeries } from '../data.ts';

const hidden = ref<string[]>([]);
const selected = ref('Click any chart element to inspect');

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

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

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" gap="sm" align-items="center" wrap>
      <ZButton size="sm" variant="outline" @click="hidden = []">
        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."
      x-key="service" min-key="min" q1-key="q1" median-key="median" q3-key="q3" max-key="max" :data="boxplotData" :series="boxplotSeries"
      selectable
      :hidden-series="hidden"
      @z-series-toggle="onToggle"
      @z-point-select="onSelect"
    />
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZBoxplotChart } from '@zelviora/vue-chart';
import { boxplotData, boxplotSeries } from '../data.ts';
</script>

<template>
  <ZBoxplotChart
    class="demo-chart-brand"
    description="Five-number latency distribution across Gateway, Auth, Search, and Billing services."
    :value-format="{ maximumFractionDigits: 1 }"
    x-key="service" min-key="min" q1-key="q1" median-key="median" q3-key="q3" max-key="max" renderer="canvas" :data="boxplotData" :series="boxplotSeries"
  >
    <span slot="heading">Service Latency Quartile Distribution (ms) — Custom Theme Tokens &amp; Canvas</span>
  </ZBoxplotChart>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZBoxplotChart } from '@zelviora/vue-chart';
import { boxplotData, boxplotSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZBoxplotChart
      heading="Loading State (aria-busy)"
      loading
      x-key="service" min-key="min" q1-key="q1" median-key="median" q3-key="q3" max-key="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."
      show-data-table
      x-key="service" min-key="min" q1-key="q1" median-key="median" q3-key="q3" max-key="max" :data="boxplotData" :series="boxplotSeries"
    />
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZBoxplotChart } from '@zelviora/vue-chart';
import { boxplotData, boxplotSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZBoxplotChart
      heading="Quartile Summary with Legend"
      description="Boxplot with legend visible vs compact distribution view."
      x-key="service" min-key="min" q1-key="q1" median-key="median" q3-key="q3" max-key="max" :data="boxplotData" :series="boxplotSeries"
    />
    <ZBoxplotChart
      heading="Compact Quartile Plot"
      description="Boxplot with legend visible vs compact distribution view."
      x-key="service" min-key="min" q1-key="q1" median-key="median" q3-key="q3" max-key="max" hide-legend :data="boxplotData" :series="boxplotSeries"
    />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZBreadcrumb, ZBreadcrumbItem } from '@zelviora/vue';
</script>

<template>
  <ZBreadcrumb>
    <ZBreadcrumbItem href="#home">Home</ZBreadcrumbItem>
    <ZBreadcrumbItem href="#products">Products</ZBreadcrumbItem>
    <ZBreadcrumbItem>Jackets</ZBreadcrumbItem>
  </ZBreadcrumb>
</template>

```

### Case: collapsed

#### Vue
```vue
<script setup lang="ts">
import { ZBreadcrumb, ZBreadcrumbItem } from '@zelviora/vue';

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

<template>
  <ZBreadcrumb :max-items="4">
    <ZBreadcrumbItem v-for="(label, i) in levels" :key="label" :href="`#level-${i + 1}`">{{ label }}</ZBreadcrumbItem>
    <ZBreadcrumbItem>Water-resistant hooded windbreaker, moss green</ZBreadcrumbItem>
  </ZBreadcrumb>
</template>

```

### Case: separator

#### Vue
```vue
<script setup lang="ts">
import { ZBreadcrumb, ZBreadcrumbItem, ZIcon, ZStack } from '@zelviora/vue';
</script>

<template>
  <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>
</template>

```

### Case: sizes

#### Vue
```vue
<script setup lang="ts">
import { ZBreadcrumb, ZBreadcrumbItem, ZStack } from '@zelviora/vue';

const sizes = ['sm', 'md', 'lg'] as const;
</script>

<template>
  <ZStack gap="md">
    <ZBreadcrumb v-for="size in sizes" :key="size" :size="size" :label="`Breadcrumb ${size}`">
      <ZBreadcrumbItem href="#home">Home</ZBreadcrumbItem>
      <ZBreadcrumbItem href="#orders">Orders</ZBreadcrumbItem>
      <ZBreadcrumbItem>Order #1024</ZBreadcrumbItem>
    </ZBreadcrumb>
  </ZStack>
</template>

```

### Case: spa-routing

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBreadcrumb, ZBreadcrumbItem } from '@zelviora/vue';

const route = ref('#/products/shoes/running');
// One zNavigate listener calls the app router (stand-in for `router.push` of Vue Router).
function navigate(e: CustomEvent<{ href: string }>) {
  e.preventDefault();
  route.value = e.detail.href; // router.push(e.detail.href)
}
// Stand-in for `<RouterLink>`: an `<a href>` that routes on a plain click.
function appLink(e: MouseEvent) {
  if (e.ctrlKey || e.metaKey || e.shiftKey || e.button !== 0) return;
  e.preventDefault();
  route.value = (e.currentTarget as HTMLAnchorElement).getAttribute('href')!;
}
</script>

<template>
  <div>
    <ZBreadcrumb :max-items="3" @z-navigate="navigate">
      <ZBreadcrumbItem><a href="#/" @click="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>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZAvatar, ZBubble, ZButton, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZStack orientation="vertical" gap="md" class="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/vue @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>
</template>

```

### Case: basic

#### Vue
```vue
<script setup lang="ts">
import { ZAvatar, ZBubble, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZStack orientation="vertical" gap="md" class="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>
</template>

```

### Case: group

#### Vue
```vue
<script setup lang="ts">
import { ZAvatar, ZBubble, ZBubbleGroup, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZStack orientation="vertical" gap="lg" class="demo-narrow">
    <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>

    <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>
</template>

```

### Case: interactive

#### Vue
```vue
<script setup lang="ts">
import { ZAvatar, ZBubble, ZStack } from '@zelviora/vue';

const handleClick = () => {
  alert('Bubble action clicked!');
};
</script>

<template>
  <ZStack orientation="vertical" gap="md" class="demo-narrow">
    <ZBubble
      author="System Prompt"
      align="start"
      variant="tinted"
      interactive
      @click="handleClick"
    >
      <ZAvatar slot="avatar" name="System Prompt" size="sm" />
      Click here to regenerate response with higher temperature.
    </ZBubble>

    <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>
</template>

```

### Case: reactions

#### Vue
```vue
<script setup lang="ts">
import { ZAvatar, ZBubble, ZBubbleReactions, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZStack orientation="vertical" gap="lg" class="demo-narrow">
    <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>

    <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>
</template>

```

### Case: typing

#### Vue
```vue
<script setup lang="ts">
import { ZAvatar, ZBubble, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZStack orientation="vertical" gap="md" class="demo-narrow">
    <ZBubble
      author="Assistant"
      align="start"
      variant="secondary"
      loading
    >
      <ZAvatar slot="avatar" name="Assistant" size="sm" />
    </ZBubble>
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZBubble, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZStack orientation="vertical" gap="sm" class="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>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZButton } from '@zelviora/vue';

function save() {
  console.log('saved');
}
</script>

<template>
  <ZButton @click="save">Save</ZButton>
</template>

```

### Case: form

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZField, ZInput, ZStack } from '@zelviora/vue';

// Submit, reset, a submitter with `name`/`value`, and `formNoValidate` that skips the required field.
const sent = ref('');

function submit(e: Event) {
  const data = new FormData(e.currentTarget as HTMLFormElement, (e as SubmitEvent).submitter);
  sent.value = JSON.stringify(Object.fromEntries(data));
}
</script>

<template>
  <form class="demo-narrow" @submit.prevent="submit" @reset="sent = ''">
    <ZStack>
      <ZField label="Title" required>
        <ZInput name="title" required />
      </ZField>
      <ZStack orientation="horizontal" align-items="center" gap="sm" wrap>
        <ZButton type="submit" name="action" value="publish">Publish</ZButton>
        <ZButton type="submit" name="action" value="draft" variant="soft" form-no-validate>Save draft</ZButton>
        <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
      </ZStack>
      <p>FormData: {{ sent || '(not submitted)' }}</p>
    </ZStack>
  </form>
</template>

```

### Case: icons

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZIcon, ZStack } from '@zelviora/vue';

// Icons go in the `icon-start` / `icon-end` slots; while loading, the spinner takes the place of the start icon.
const loading = ref(false);

function next() {
  loading.value = true;
  setTimeout(() => (loading.value = false), 2000);
}
</script>

<template>
  <ZStack orientation="horizontal" align-items="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" @click="next">
      <ZIcon slot="icon-start" name="chevron_right" />
      Continue
    </ZButton>
  </ZStack>
</template>

```

### Case: link

#### Vue
```vue
<script setup lang="ts">
// With `href` the button renders an `<a>`; `_blank` adds `rel="noopener noreferrer"`. A disabled link is not focusable.
import { ZButton, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZStack orientation="horizontal" align-items="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>
</template>

```

### Case: loading

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton } from '@zelviora/vue';

// Loading driven from outside: the click starts a 2 s task; the button keeps its size and focus meanwhile.
const loading = ref(false);

function save() {
  loading.value = true;
  setTimeout(() => (loading.value = false), 2000);
}
</script>

<template>
  <ZButton :loading="loading" @click="save">Save changes</ZButton>
</template>

```

### Case: sizes

#### Vue
```vue
<script setup lang="ts">
// Without `size` the button follows the nearest config-provider, then `md`; `block` takes the full width.
import { ZButton, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" align-items="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>
</template>

```

### Case: spa-routing

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton } from '@zelviora/vue';

const route = ref('#/home');
// One zNavigate listener calls the app router (stand-in for `router.push` of Vue Router).
function navigate(e: CustomEvent<{ href: string }>) {
  e.preventDefault();
  route.value = e.detail.href; // router.push(e.detail.href)
}
</script>

<template>
  <div>
    <ZButton href="#/orders/new" @z-navigate="navigate">New order</ZButton>
    <p aria-live="polite">Current route: <code>{{ route }}</code></p>
  </div>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZStack } from '@zelviora/vue';

// Disabled in every variant, loading, and disabled through a native `fieldset[disabled]`.
const variants = ['solid', 'soft', 'outline', 'ghost', 'dashed', 'link'] as const;
</script>

<template>
  <ZStack gap="lg">
    <ZStack orientation="horizontal" align-items="center" gap="sm" wrap>
      <ZButton v-for="variant in variants" :key="variant" :variant="variant" disabled>Disabled</ZButton>
    </ZStack>
    <ZStack orientation="horizontal" align-items="center" gap="sm" wrap>
      <ZButton loading>Saving</ZButton>
      <ZButton variant="outline" tone="neutral" loading loading-label="Exporting the report">Export</ZButton>
    </ZStack>
    <fieldset disabled>
      <legend>Fieldset disabled</legend>
      <ZStack orientation="horizontal" align-items="center" gap="sm" wrap>
        <ZButton>Save</ZButton>
        <ZButton variant="outline" tone="neutral">Cancel</ZButton>
      </ZStack>
    </fieldset>
  </ZStack>
</template>

```

### Case: tones

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZStack } from '@zelviora/vue';

// One row per variant, one button per tone.
const tones = ['primary', 'neutral', 'success', 'warning', 'destructive', 'info'] as const;
const variants = ['solid', 'soft', 'outline', 'ghost'] as const;
</script>

<template>
  <ZStack gap="sm">
    <ZStack v-for="variant in variants" :key="variant" orientation="horizontal" align-items="center" gap="sm" wrap>
      <ZButton v-for="tone in tones" :key="tone" :variant="variant" :tone="tone">
        {{ tone[0].toUpperCase() + tone.slice(1) }}
      </ZButton>
    </ZStack>
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZStack } from '@zelviora/vue';

const variants = ['solid', 'soft', 'outline', 'ghost', 'dashed', 'link'] as const;
</script>

<template>
  <ZStack orientation="horizontal" align-items="center" gap="md" wrap>
    <ZButton v-for="variant in variants" :key="variant" :variant="variant">
      {{ variant[0].toUpperCase() + variant.slice(1) }}
    </ZButton>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZButtonGroup } from '@zelviora/vue';
</script>

<template>
  <ZButtonGroup label="Text alignment" variant="outline">
    <ZButton tone="neutral">Left</ZButton>
    <ZButton tone="neutral">Center</ZButton>
    <ZButton tone="neutral">Right</ZButton>
  </ZButtonGroup>
</template>

```

### Case: split

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZButtonGroup, ZDropdownMenu, ZIcon, ZIconButton, ZMenuItem, ZStack } from '@zelviora/vue';

const last = ref('');
function onSelect(e: CustomEvent<{ value: string }>) {
  last.value = e.detail.value;
}
</script>

<template>
  <ZStack orientation="horizontal" align-items="center" gap="md" wrap>
    <ZButtonGroup label="Save options">
      <ZButton @click="last = 'save'">Save</ZButton>
      <ZDropdownMenu @z-select="onSelect">
        <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>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZButtonGroup, ZStack } from '@zelviora/vue';

const sizes = ['sm', 'md', 'lg'] as const;
</script>

<template>
  <ZStack gap="md">
    <ZButtonGroup v-for="size in sizes" :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>
</template>

```

### Case: vertical

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZButtonGroup } from '@zelviora/vue';
</script>

<template>
  <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>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZCalendar, ZCard } from '@zelviora/vue';

// In a card: event dots in the `day:<date>` slots (decorative), the same count read through `getDayDescription`.
const EVENTS: Record<string, number> = { '2026-10-05': 2, '2026-10-12': 1, '2026-10-21': 3 };
const describe = (d: string) => (EVENTS[d] ? `${EVENTS[d]} ${EVENTS[d] === 1 ? 'meeting' : 'meetings'}` : undefined);
</script>

<template>
  <ZCard heading="Meetings" class="demo-narrow">
    <ZCalendar label="Meetings" today="2026-10-02" :get-day-description="describe">
      <span v-for="d in Object.keys(EVENTS)" :key="d" :slot="`day:${d}`" class="demo-calendar-dot"></span>
      <ZButton slot="footer" size="sm" variant="ghost">Today</ZButton>
    </ZCalendar>
  </ZCard>
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZCalendar, ZStack } from '@zelviora/vue';

// The app owns `value` (v-model) and `month`: buttons set them from code (no event); the log lists user changes.
const value = ref<string | string[] | null>('2026-10-15');
const month = ref('2026-10');
const log = ref<string[]>([]);
const add = (line: string) => { log.value = [line, ...log.value].slice(0, 5); };

function onChange(e: CustomEvent<{ value: string | string[] | null }>) {
  add(`zChange ${String(e.detail.value)}`);
}
function onMonth(e: CustomEvent<{ month: string }>) {
  month.value = e.detail.month;
  add(`zMonthChange ${e.detail.month}`);
}
function onView(e: CustomEvent<{ view: string }>) {
  add(`zViewChange ${e.detail.view}`);
}
function setEnd() {
  value.value = '2026-12-31';
  month.value = '2026-12';
}
</script>

<template>
  <ZStack class="demo-narrow">
    <ZCalendar v-model="value" label="Deadline" today="2026-10-02" :month="month" @z-change="onChange" @z-month-change="onMonth" @z-view-change="onView" />
    <ZStack orientation="horizontal" gap="sm" wrap>
      <ZButton variant="outline" tone="neutral" @click="setEnd">Set Dec 31, 2026</ZButton>
      <ZButton variant="outline" tone="neutral" @click="month = '2027-01'">Show Jan 2027</ZButton>
      <ZButton variant="outline" tone="neutral" @click="value = null">Clear</ZButton>
    </ZStack>
    <span>Value: {{ String(value ?? 'null') }} · month: {{ month }}</span>
    <output>{{ log.join(' · ') }}</output>
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZCalendar } from '@zelviora/vue';

// Calendar tokens and the day state parts (`::part(day-selected)`): see the `demo-calendar-brand` rule in README.
</script>

<template>
  <ZCalendar class="demo-calendar-brand" label="Appointment date" today="2026-10-02" selection-mode="range" :value="['2026-10-12', '2026-10-16']" />
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZCalendar, ZStack } from '@zelviora/vue';

// A standalone month grid: arrows move by day / week, PageUp/PageDown by month, Enter selects; "today" is fixed.
// v-model binds `value` through the model event `zChange`.
const value = ref<string | string[] | null>('2026-10-15');
</script>

<template>
  <ZStack class="demo-narrow">
    <ZCalendar v-model="value" label="Delivery date" today="2026-10-02" />
    <span>Value: {{ String(value ?? 'null') }}</span>
  </ZStack>
</template>

```

### Case: i18n

#### Vue
```vue
<script setup lang="ts">
import { ZCalendar, ZGrid } from '@zelviora/vue';

// Month and weekday names and the first day of the week follow the locale: vi (Monday), en-US (Sunday), Arabic in RTL.
</script>

<template>
  <ZGrid columns="1 md:3" gap="lg">
    <ZCalendar label="Tiếng Việt" locale="vi" today="2026-10-02" value="2026-10-15" />
    <ZCalendar label="English (US)" locale="en-US" today="2026-10-02" value="2026-10-15" />
    <div dir="rtl" lang="ar-EG">
      <ZCalendar label="العربية" locale="ar-EG" today="2026-10-02" value="2026-10-15" />
    </div>
  </ZGrid>
</template>

```

### Case: months

#### Vue
```vue
<script setup lang="ts">
import { ZCalendar } from '@zelviora/vue';

// Three months side by side with ISO week numbers, picking a range across months.
</script>

<template>
  <ZCalendar label="Holiday" today="2026-10-02" selection-mode="range" :number-of-months="3" week-numbers :value="['2026-10-26', '2026-11-04']" />
</template>

```

### Case: sizes

#### Vue
```vue
<script setup lang="ts">
import { ZCalendar, ZGrid } from '@zelviora/vue';

// Cell sizes follow the control heights: small, medium (default) and large.
</script>

<template>
  <ZGrid columns="1 md:3" gap="lg">
    <ZCalendar label="Small" size="sm" today="2026-10-02" value="2026-10-15" />
    <ZCalendar label="Medium" size="md" today="2026-10-02" value="2026-10-15" />
    <ZCalendar label="Large" size="lg" today="2026-10-02" value="2026-10-15" />
  </ZGrid>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZCalendar, ZGrid } from '@zelviora/vue';

// Today, selected range, outside days, unavailable days (min / max), outside days hidden, disabled and readonly.
</script>

<template>
  <ZGrid columns="1 sm:2" gap="lg">
    <ZCalendar label="Range, min 05 / max 25" today="2026-10-02" selection-mode="range" :value="['2026-10-08', '2026-10-14']" min="2026-10-05" max="2026-10-25" />
    <ZCalendar label="Outside days hidden" today="2026-10-02" value="2026-10-02" hide-outside-days />
    <ZCalendar label="Disabled" today="2026-10-02" value="2026-10-15" disabled />
    <ZCalendar label="Readonly" today="2026-10-02" value="2026-10-15" readonly />
  </ZGrid>
</template>

```

### Case: unavailable

#### Vue
```vue
<script setup lang="ts">
import { ZCalendar } from '@zelviora/vue';

// Weekends and holidays are unavailable: focusable, read as unavailable, not selectable.
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);
};
</script>

<template>
  <ZCalendar class="demo-narrow" label="Working day" today="2026-10-02" :is-date-unavailable="isClosed">
    <span slot="footer">Closed on Saturdays, Sundays and Oct 20</span>
  </ZCalendar>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZCalendar, ZGrid } from '@zelviora/vue';

// Selection modes: one day, several days, a range of days, and display only (no selection).
</script>

<template>
  <ZGrid columns="1 sm:2" gap="lg">
    <ZCalendar label="single" today="2026-10-02" value="2026-10-15" />
    <ZCalendar label="multiple" today="2026-10-02" selection-mode="multiple" :value="['2026-10-06', '2026-10-08', '2026-10-20']" />
    <ZCalendar label="range" today="2026-10-02" selection-mode="range" :value="['2026-10-12', '2026-10-16']" />
    <ZCalendar label="none" today="2026-10-02" selection-mode="none" />
  </ZGrid>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZCandlestickChart } from '@zelviora/vue-chart';
import { ohlcData, ohlcSeries } from '../data.ts';
</script>

<template>
  <ZCandlestickChart
    heading="Daily OHLC Price Action (USD)"
    description="Five-day trading sessions showing open, close, intraday low, and intraday high prices."
    x-key="date" open-key="open" close-key="close" low-key="low" high-key="high" :data="ohlcData" :series="ohlcSeries"
  />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/vue';
import {
  ZCandlestickChart,
  type ChartPointSelectDetail,
  type ChartSeriesToggleDetail,
} from '@zelviora/vue-chart';
import { ohlcData, ohlcSeries } from '../data.ts';

const hidden = ref<string[]>([]);
const selected = ref('Click any chart element to inspect');

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

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

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" gap="sm" align-items="center" wrap>
      <ZButton size="sm" variant="outline" @click="hidden = []">
        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."
      x-key="date" open-key="open" close-key="close" low-key="low" high-key="high" :data="ohlcData" :series="ohlcSeries"
      selectable
      :hidden-series="hidden"
      @z-series-toggle="onToggle"
      @z-point-select="onSelect"
    />
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZCandlestickChart } from '@zelviora/vue-chart';
import { ohlcData, ohlcSeries } from '../data.ts';
</script>

<template>
  <ZCandlestickChart
    class="demo-chart-brand"
    description="Five-day trading sessions showing open, close, intraday low, and intraday high prices."
    :value-format="{ maximumFractionDigits: 1 }"
    x-key="date" open-key="open" close-key="close" low-key="low" high-key="high" data-zoom renderer="canvas" :data="ohlcData" :series="ohlcSeries"
  >
    <span slot="heading">Daily OHLC Price Action (USD) — Custom Theme Tokens &amp; Canvas</span>
  </ZCandlestickChart>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZCandlestickChart } from '@zelviora/vue-chart';
import { ohlcData, ohlcSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZCandlestickChart
      heading="Loading State (aria-busy)"
      loading
      x-key="date" open-key="open" close-key="close" low-key="low" high-key="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."
      show-data-table
      x-key="date" open-key="open" close-key="close" low-key="low" high-key="high" :data="ohlcData" :series="ohlcSeries"
    />
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZCandlestickChart } from '@zelviora/vue-chart';
import { ohlcData, ohlcSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZCandlestickChart
      heading="Interactive DataZoom Candlesticks"
      description="Interactive dataZoom trading view vs compact session view."
      x-key="date" open-key="open" close-key="close" low-key="low" high-key="high" data-zoom :data="ohlcData" :series="ohlcSeries"
    />
    <ZCandlestickChart
      heading="Standard Session View"
      description="Interactive dataZoom trading view vs compact session view."
      x-key="date" open-key="open" close-key="close" low-key="low" high-key="high" hide-legend :data="ohlcData" :series="ohlcSeries"
    />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZCard } from '@zelviora/vue';
</script>

<template>
  <ZCard heading="Revenue, September" description="Updated 2 hours ago" as="section" class="demo-narrow">
    <p>1.2 billion VND, up 12% from August.</p>
    <ZButton slot="footer" variant="outline" tone="neutral">View details</ZButton>
  </ZCard>
</template>

```

### Case: link

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZCard } from '@zelviora/vue';

const onShare = () => console.log('shared');
</script>

<template>
  <ZCard heading="Quarterly report" description="Q3 2026" href="#report-q3" as="article" class="demo-narrow">
    <p>Click anywhere on the card to open the report.</p>
    <ZButton slot="footer" variant="ghost" tone="neutral" @click="onShare">Share</ZButton>
  </ZCard>
</template>

```

### Case: loading

#### Vue
```vue
<script setup lang="ts">
import { onMounted, onUnmounted, ref } from 'vue';
import { ZCard } from '@zelviora/vue';

const loading = ref(true);
let timer: ReturnType<typeof setTimeout> | undefined;
onMounted(() => (timer = setTimeout(() => (loading.value = false), 2000)));
onUnmounted(() => clearTimeout(timer));
</script>

<template>
  <ZCard heading="Active users" :loading="loading" class="demo-narrow">
    <p>4,210 users in the last 30 days.</p>
  </ZCard>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZCard, ZGrid } from '@zelviora/vue';
</script>

<template>
  <ZGrid min-column-width="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>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZCarousel, ZCarouselItem, ZStack } from '@zelviora/vue';

// 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.
const SLIDES = ['20% off in October', 'Free shipping', 'Member gifts'];
const playing = ref(true);
</script>

<template>
  <ZStack>
    <ZCarousel label="Banner" autoplay :autoplay-interval="4000" @z-autoplay-change="playing = $event.detail.playing">
      <ZCarouselItem v-for="s in SLIDES" :key="s" :label="s"><div class="demo-carousel-slide">{{ s }}</div></ZCarouselItem>
    </ZCarousel>
    <span>Autoplay: {{ playing ? 'on' : 'stopped' }}</span>
  </ZStack>
</template>

```

### Case: composition

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZCard, ZCarousel, ZCarouselItem } from '@zelviora/vue';

// Slides are cards with actions, two per page; only the cards of the current page are reachable with Tab.
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' },
];
</script>

<template>
  <ZCarousel label="Pricing" :slides-per-page="2">
    <ZCarouselItem v-for="p in PLANS" :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>
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZCarousel, ZCarouselItem, ZStack } from '@zelviora/vue';

// The app owns `index` (v-model binds `index` through `zChange`): setting it emits nothing;
// `goTo()` emits `reason: programmatic`; the log lists every change.
const SLIDES = ['One', 'Two', 'Three', 'Four', 'Five'];
const index = ref(1);
const log = ref<string[]>([]);
const carousel = ref<{ $el: HTMLElement & { goTo(i: number): Promise<void> } } | null>(null);

function onChange(e: CustomEvent<{ index: number; reason: string }>) {
  log.value = [`${e.detail.index} (${e.detail.reason})`, ...log.value].slice(0, 5);
}
</script>

<template>
  <ZStack>
    <ZCarousel ref="carousel" v-model="index" label="Controlled" @z-change="onChange">
      <ZCarouselItem v-for="s in SLIDES" :key="s"><div class="demo-carousel-slide">{{ s }}</div></ZCarouselItem>
    </ZCarousel>
    <ZStack orientation="horizontal" gap="sm" wrap>
      <ZButton variant="outline" tone="neutral" @click="index = 0">index = 0</ZButton>
      <ZButton variant="outline" tone="neutral" @click="index = 4">index = 4</ZButton>
      <ZButton variant="outline" tone="neutral" @click="carousel?.$el.goTo(2)">goTo(2)</ZButton>
    </ZStack>
    <span>Index: {{ index }}</span>
    <output>{{ log.join(' · ') }}</output>
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZCarousel, ZCarouselItem } from '@zelviora/vue';

// Component tokens and parts (`::part(picker-item-active)`): see the `demo-carousel-brand` rule in README.
const SLIDES = ['One', 'Two', 'Three'];
</script>

<template>
  <ZCarousel class="demo-carousel-brand" label="Customization" loop>
    <ZCarouselItem v-for="s in SLIDES" :key="s"><div class="demo-carousel-slide">{{ s }}</div></ZCarouselItem>
  </ZCarousel>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ZCarousel, ZCarouselItem } from '@zelviora/vue';

// Five slides with previous / next buttons and a picker; swipe, scroll or drag the track; Tab reaches the buttons.
const SLIDES = ['20% off in October', 'Free shipping', 'Member gifts', '0% installments', '30-day returns'];
</script>

<template>
  <ZCarousel label="Featured offers">
    <ZCarouselItem v-for="s in SLIDES" :key="s" :label="s"><div class="demo-carousel-slide">{{ s }}</div></ZCarouselItem>
  </ZCarousel>
</template>

```

### Case: i18n

#### Vue
```vue
<script setup lang="ts">
import { ZCarousel, ZCarouselItem, ZStack } from '@zelviora/vue';

// Button and slide names follow the locale (vi); in RTL the next button scrolls toward the left.
const SLIDES = ['1', '2', '3'];
</script>

<template>
  <ZStack gap="lg">
    <div lang="vi">
      <ZCarousel label="Tiếng Việt">
        <ZCarouselItem v-for="s in SLIDES" :key="s"><div class="demo-carousel-slide">{{ `Slide ${s}` }}</div></ZCarouselItem>
      </ZCarousel>
    </div>
    <div dir="rtl" lang="ar">
      <ZCarousel label="RTL" picker="tabs">
        <ZCarouselItem v-for="s in SLIDES" :key="s"><div class="demo-carousel-slide">{{ `RTL ${s}` }}</div></ZCarouselItem>
      </ZCarousel>
    </div>
  </ZStack>
</template>

```

### Case: per-page

#### Vue
```vue
<script setup lang="ts">
import { ZCarousel, ZCarouselItem, ZContainer, ZStack } from '@zelviora/vue';

// Two and three slides per page (30 slides), and `slides-per-page="auto"` read from a container query
// (`demo-carousel-auto` rule in README).
const MANY = Array.from({ length: 30 }, (_, i) => `Product ${i + 1}`);
</script>

<template>
  <ZStack gap="lg">
    <ZCarousel label="2 per page" :slides-per-page="2">
      <ZCarouselItem v-for="s in MANY.slice(0, 6)" :key="s"><div class="demo-carousel-slide">{{ s }}</div></ZCarouselItem>
    </ZCarousel>
    <ZCarousel label="3 per page, 30 slides" :slides-per-page="3" gap="sm">
      <ZCarouselItem v-for="s in MANY" :key="s"><div class="demo-carousel-slide">{{ s }}</div></ZCarouselItem>
    </ZCarousel>
    <ZContainer padding="none">
      <ZCarousel class="demo-carousel-auto" label="auto" slides-per-page="auto">
        <ZCarouselItem v-for="s in MANY.slice(0, 8)" :key="s"><div class="demo-carousel-slide">{{ s }}</div></ZCarouselItem>
      </ZCarousel>
    </ZContainer>
  </ZStack>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZCarousel, ZCarouselItem, ZStack } from '@zelviora/vue';

// First page (previous is aria-disabled, still focusable), last page, loop (no edge), and no slide (nothing shown).
const SLIDES = ['One', 'Two', 'Three'];
</script>

<template>
  <ZStack gap="lg">
    <ZCarousel label="First page">
      <ZCarouselItem v-for="s in SLIDES" :key="s"><div class="demo-carousel-slide">{{ s }}</div></ZCarouselItem>
    </ZCarousel>
    <ZCarousel label="Last page" :index="2">
      <ZCarouselItem v-for="s in SLIDES" :key="s"><div class="demo-carousel-slide">{{ s }}</div></ZCarouselItem>
    </ZCarousel>
    <ZCarousel label="Loop" loop>
      <ZCarouselItem v-for="s in SLIDES" :key="s"><div class="demo-carousel-slide">{{ `loop: ${s}` }}</div></ZCarouselItem>
    </ZCarousel>
    <ZCarousel label="Empty"></ZCarousel>
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZCarousel, ZCarouselItem, ZStack } from '@zelviora/vue';

// Picker as buttons with aria-current (default), as an APG tab list (arrow keys), or none.
const SLIDES = ['One', 'Two', 'Three', 'Four'];
const PICKERS = ['buttons', 'tabs', 'none'] as const;
</script>

<template>
  <ZStack gap="lg">
    <ZCarousel v-for="picker in PICKERS" :key="picker" :label="`picker ${picker}`" :picker="picker">
      <ZCarouselItem v-for="s in SLIDES" :key="s"><div class="demo-carousel-slide">{{ `${picker}: ${s}` }}</div></ZCarouselItem>
    </ZCarousel>
  </ZStack>
</template>

```

### Case: vertical

#### Vue
```vue
<script setup lang="ts">
import { ZCarousel, ZCarouselItem } from '@zelviora/vue';

// Vertical track (orientation vertical): buttons and picker move up and down.
const NEWS = ['Version 2.0 released', 'System maintenance on Oct 20', 'We are hiring engineers', 'User conference'];
</script>

<template>
  <ZCarousel label="News" orientation="vertical">
    <ZCarouselItem v-for="s in NEWS" :key="s" :label="s"><div class="demo-carousel-slide">{{ s }}</div></ZCarouselItem>
  </ZCarousel>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZCascader, ZStack } from '@zelviora/vue';
import { places } from '../data.ts';

// changeOnSelect: any level can be chosen; expandTrigger="hover" opens columns on mouse hover.
const value = ref<string[] | null>(null);
</script>

<template>
  <ZStack class="demo-narrow">
    <ZCascader v-model="value" label="Region (any level)" change-on-select :options="places" />
    <span>Value: {{ value ? value.join(' → ') : 'null' }}</span>
    <ZCascader label="Open on hover" expand-trigger="hover" :options="places" />
  </ZStack>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZCascader, ZStack } from '@zelviora/vue';
import { places } from '../data.ts';

// Province → district → ward; a disabled province, clear button; filled variant, disabled and readonly.
const value = ref<string[] | null>(['hn', 'ba-dinh', 'phuc-xa']);
const fixed = ['dn', 'hai-chau', 'thach-thang'];
</script>

<template>
  <ZStack class="demo-narrow">
    <ZCascader v-model="value" label="Address" :options="places" clearable />
    <span>Value: {{ value ? value.join(' → ') : 'null' }}</span>
    <ZCascader label="Filled" variant="filled" :options="places" display-separator=" › " />
    <ZCascader label="Disabled" :options="places" :value="fixed" disabled />
    <ZCascader label="Readonly" :options="places" :value="fixed" readonly />
  </ZStack>
</template>

```

### Case: form

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZCascader, ZStack } from '@zelviora/vue';
import { places } from '../data.ts';

// Required in a native form: the leaf value (default) or every level (formValue="path").
const sent = ref('');

function submit(e: Event) {
  const data = new FormData(e.currentTarget as HTMLFormElement);
  sent.value = JSON.stringify({ ward: data.get('ward'), path: data.getAll('path') });
}
</script>

<template>
  <form class="demo-narrow" @submit.prevent="submit">
    <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' form-value="path" :options="places" />
      <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
        <ZButton type="submit">Submit</ZButton>
        <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
      </ZStack>
      <output v-if="sent">{{ sent }}</output>
    </ZStack>
  </form>
</template>

```

### Case: i18n

#### Vue
```vue
<script setup lang="ts">
import { ZCascader, ZConfigProvider } from '@zelviora/vue';
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.
</script>

<template>
  <ZConfigProvider locale="vi">
    <div class="demo-narrow">
      <ZCascader label="Tìm địa chỉ" searchable :options="places" />
    </div>
  </ZConfigProvider>
</template>

```

### Case: lazy

#### Vue
```vue
<script setup lang="ts">
import { ZCascader, ZStack } from '@zelviora/vue';
import { loadRegion, regions } from '../data.ts';

// loadChildren: columns load on demand (fixed delay); the option shows a busy indicator meanwhile.
</script>

<template>
  <ZStack class="demo-narrow">
    <ZCascader label="Branch" :options="regions" :load-children="loadRegion" />
  </ZStack>
</template>

```

### Case: search

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZCascader, ZStack } from '@zelviora/vue';
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.
const log = ref('');

function onSearch(e: CustomEvent<{ query: string }>) {
  log.value = `zSearch "${e.detail.query}"`;
}
</script>

<template>
  <ZStack class="demo-narrow">
    <ZCascader label="Find address" searchable :options="places" @z-search="onSearch" />
    <ZCascader label="Units (1,000 items)" searchable :options="manyOptions" @z-load-more="log = 'zLoadMore'" />
    <output>{{ log }}</output>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
// Importing `@zelviora/third-party/chart` once registers the drawing library (optional peer `d3-shape`).
import '@zelviora/third-party/chart';
import { ZChart } from '@zelviora/vue/third-party';
import { revenue, revenueSeries } from '../data.ts';
</script>

<template>
  <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."
    x-key="quarter"
    :data="revenue"
    :series="revenueSeries"
  />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import '@zelviora/third-party/chart';
import { ZButton, ZStack } from '@zelviora/vue';
import { ZChart } from '@zelviora/vue/third-party';
import { revenue, revenueSeries } from '../data.ts';

// v-model binds hiddenSeries (model event zSeriesToggle).
const hidden = ref<string[]>(['y2024']);
const toggle = (key: string) => {
  hidden.value = hidden.value.includes(key) ? hidden.value.filter((k) => k !== key) : [...hidden.value, key];
};
</script>

<template>
  <!-- The app owns hiddenSeries: the buttons and the legend change the same state. -->
  <ZStack>
    <ZStack orientation="horizontal" gap="sm">
      <ZButton v-for="s in revenueSeries" :key="s.key" variant="outline" tone="neutral" @click="toggle(s.key)">
        {{ hidden.includes(s.key) ? `Show ${s.label}` : `Hide ${s.label}` }}
      </ZButton>
    </ZStack>
    <ZChart v-model="hidden" type="line" heading="Revenue per quarter" x-key="quarter" :data="revenue" :series="revenueSeries" />
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import '@zelviora/third-party/chart';
import { ZChart } from '@zelviora/vue/third-party';
import { revenue, revenueSeries } from '../data.ts';
</script>

<template>
  <!-- Component tokens (series colors, height) and parts (heading, legend item) through the demo-chart-brand class. -->
  <ZChart class="demo-chart-brand" type="bar" x-key="quarter" :data="revenue" :series="revenueSeries">
    <span slot="heading">Revenue per quarter, brand colors</span>
  </ZChart>
</template>

```

### Case: dashboard

#### Vue
```vue
<script setup lang="ts">
import '@zelviora/third-party/chart';
import { ZButton, ZCard, ZGrid, ZGridItem } from '@zelviora/vue';
import { ZChart } from '@zelviora/vue/third-party';
import { revenue, revenueSeries, traffic, visitsSeries } from '../data.ts';
</script>

<template>
  <!-- Charts in dashboard cards: the card gives the frame and actions, the chart keeps its own caption and data table. -->
  <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" x-key="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" x-key="source" :data="traffic" :series="visitsSeries" />
        <ZButton slot="footer" variant="outline" tone="neutral">Open analytics</ZButton>
      </ZCard>
    </ZGridItem>
  </ZGrid>
</template>

```

### Case: i18n

#### Vue
```vue
<script setup lang="ts">
import '@zelviora/third-party/chart';
import { ZConfigProvider, ZGrid, ZGridItem } from '@zelviora/vue';
import { ZChart } from '@zelviora/vue/third-party';
import { revenueSeries, revenueVnd } from '../data.ts';

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

<template>
  <!-- Numbers and texts follow the locale of the nearest `lang` (config provider): `vi` and `en-US`. -->
  <ZGrid columns="1 md:2" gap="lg">
    <ZGridItem>
      <ZConfigProvider locale="vi">
        <ZChart heading="Doanh thu theo quý" show-data-table :value-format="money" x-key="quarter" :data="revenueVnd" :series="revenueSeries" />
      </ZConfigProvider>
    </ZGridItem>
    <ZGridItem>
      <ZConfigProvider locale="en-US">
        <ZChart heading="Revenue per quarter" show-data-table :value-format="money" x-key="quarter" :data="revenueVnd" :series="revenueSeries" />
      </ZConfigProvider>
    </ZGridItem>
  </ZGrid>
</template>

```

### Case: keyboard

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import '@zelviora/third-party/chart';
import type { ZChartCustomEvent, ZChartPointSelectDetail } from '@zelviora/third-party';
import { ZStack } from '@zelviora/vue';
import { ZChart } from '@zelviora/vue/third-party';
import { revenue, revenueSeries } from '../data.ts';

const picked = ref('Nothing selected');
const onSelect = (e: ZChartCustomEvent<ZChartPointSelectDetail>) => {
  picked.value = `${e.detail.seriesKey} · ${String(e.detail.datum.quarter)}`;
};
</script>

<template>
  <!-- Tab to the plot, move with the arrow keys (the value is announced), Enter selects, Escape hides the tooltip. -->
  <ZStack>
    <ZChart type="bar" heading="Revenue per quarter" selectable x-key="quarter" :data="revenue" :series="revenueSeries" @z-point-select="onSelect" />
    <output>{{ picked }}</output>
  </ZStack>
</template>

```

### Case: long

#### Vue
```vue
<script setup lang="ts">
import '@zelviora/third-party/chart';
import { ZStack } from '@zelviora/vue';
import { ZChart } from '@zelviora/vue/third-party';
import { regions, salesSeries, signups, signupsSeries } from '../data.ts';

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

<template>
  <!-- 200 points with a long series label, then long category names with large numbers (compact currency). -->
  <ZStack gap="lg">
    <ZChart type="line" heading="Sign-ups over 200 days" x-key="day" :data="signups" :series="signupsSeries" />
    <ZChart type="bar" orientation="horizontal" heading="Sales by region" :value-format="vnd" x-key="region" :data="regions" :series="salesSeries" show-data-table />
  </ZStack>
</template>

```

### Case: rtl

#### Vue
```vue
<script setup lang="ts">
import '@zelviora/third-party/chart';
import { ZGrid, ZGridItem } from '@zelviora/vue';
import { ZChart } from '@zelviora/vue/third-party';
import { revenueAr, revenueSeriesAr } from '../data.ts';
</script>

<template>
  <!-- RTL: the category axis runs from the right, value ticks sit on the right and the arrow keys follow the reading order. -->
  <div dir="rtl" lang="ar">
    <ZGrid columns="1 md:2" gap="lg">
      <ZGridItem><ZChart type="bar" heading="الإيرادات حسب الربع" x-key="quarter" :data="revenueAr" :series="revenueSeriesAr" keyboard-navigation /></ZGridItem>
      <ZGridItem><ZChart type="line" heading="الإيرادات حسب الربع (خط)" x-key="quarter" :data="revenueAr" :series="revenueSeriesAr" /></ZGridItem>
    </ZGrid>
  </div>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import '@zelviora/third-party/chart';
import { ZGrid, ZGridItem } from '@zelviora/vue';
import { ZChart } from '@zelviora/vue/third-party';
import { revenue, revenueSeries } from '../data.ts';
</script>

<template>
  <!-- Loading (skeleton, aria-busy), empty data (default empty state) and the data table shown visually. -->
  <ZGrid columns="1 md:2" gap="lg">
    <ZGridItem><ZChart heading="Loading" loading x-key="quarter" :data="revenue" :series="revenueSeries" /></ZGridItem>
    <ZGridItem><ZChart heading="No data yet" x-key="quarter" :data="[]" :series="revenueSeries" /></ZGridItem>
    <ZGridItem><ZChart type="line" heading="With the data table" show-data-table x-key="quarter" :data="revenue" :series="revenueSeries" /></ZGridItem>
  </ZGrid>
</template>

```

### Case: theme

#### Vue
```vue
<script setup lang="ts">
import '@zelviora/third-party/chart';
import { ZCard, ZConfigProvider, ZGrid, ZGridItem } from '@zelviora/vue';
import { ZChart } from '@zelviora/vue/third-party';
import { revenue, revenueSeries } from '../data.ts';
</script>

<template>
  <!-- Light and dark side by side: series, grid and axis colors come from tokens, so a theme change restyles the chart. -->
  <ZGrid columns="1 md:2" gap="lg">
    <ZGridItem>
      <ZConfigProvider theme="light">
        <ZCard><ZChart type="area" heading="Revenue (light)" x-key="quarter" :data="revenue" :series="revenueSeries" /></ZCard>
      </ZConfigProvider>
    </ZGridItem>
    <ZGridItem>
      <ZConfigProvider theme="dark">
        <ZCard><ZChart type="area" heading="Revenue (dark)" x-key="quarter" :data="revenue" :series="revenueSeries" /></ZCard>
      </ZConfigProvider>
    </ZGridItem>
  </ZGrid>
</template>

```

### Case: types

#### Vue
```vue
<script setup lang="ts">
import '@zelviora/third-party/chart';
import { ZGrid, ZGridItem } from '@zelviora/vue';
import { ZChart } from '@zelviora/vue/third-party';
import { latency, latencySeries, revenue, revenueSeries, traffic, visitsSeries } from '../data.ts';
</script>

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

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZCheckbox } from '@zelviora/vue';
</script>

<template>
  <ZCheckbox name="remember">Remember me</ZCheckbox>
</template>

```

### Case: group

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZCheckbox, ZCheckboxGroup, ZStack } from '@zelviora/vue';

const value = ref<string[]>(['cheese']);
</script>

<template>
  <ZStack>
    <ZCheckboxGroup v-model="value" name="toppings" label="Toppings" hint="Pick at least one." required>
      <ZCheckbox value="cheese">Cheese</ZCheckbox>
      <ZCheckbox value="mushroom">Mushroom</ZCheckbox>
      <ZCheckbox value="olive">Olive</ZCheckbox>
    </ZCheckboxGroup>
    <p>Selected: {{ value.join(', ') || 'none' }}</p>
  </ZStack>
</template>

```

### Case: select-all

#### Vue
```vue
<script setup lang="ts">
import { computed, ref } from 'vue';
import { ZCheckbox, ZStack } from '@zelviora/vue';

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

const selected = ref<string[]>(['report.pdf']);
const all = computed(() => selected.value.length === FILES.length);
const some = computed(() => selected.value.length > 0 && !all.value);

function toggleAll(e: CustomEvent<{ checked: boolean }>) {
  selected.value = e.detail.checked ? [...FILES] : [];
}
function toggle(f: string, e: CustomEvent<{ checked: boolean }>) {
  selected.value = e.detail.checked ? [...selected.value, f] : selected.value.filter((x) => x !== f);
}
</script>

<template>
  <ZStack gap="sm">
    <ZCheckbox :checked="all" :indeterminate="some" @z-change="toggleAll">Select all files</ZCheckbox>
    <ZCheckbox v-for="f in FILES" :key="f" :checked="selected.includes(f)" @z-change="toggle(f, $event)">{{ f }}</ZCheckbox>
  </ZStack>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZCheckbox, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZStack gap="sm">
    <ZCheckbox>Unchecked</ZCheckbox>
    <ZCheckbox checked>Checked</ZCheckbox>
    <ZCheckbox indeterminate>Indeterminate</ZCheckbox>
    <ZCheckbox disabled checked>Disabled</ZCheckbox>
    <ZCheckbox readonly checked>Read-only</ZCheckbox>
    <ZCheckbox invalid hint="You must accept the terms to continue.">I accept the terms</ZCheckbox>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZCodeBlock } from '@zelviora/vue';

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

// <ZButton>Save</ZButton>`;
</script>

<template>
  <ZCodeBlock language="ts" :code="code" />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZCodeBlock, ZStack } from '@zelviora/vue';

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

<template>
  <ZStack gap="sm">
    <ZCodeBlock language="bash" code="export API_KEY=sk_live_1234" @z-copy="onCopy" />
    <span>{{ message || 'Press the copy button.' }}</span>
  </ZStack>
</template>

```

### Case: highlighter

#### Vue
```vue
<script setup lang="ts">
import { ZCodeBlock } from '@zelviora/vue';

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;
}`;
</script>

<template>
  <ZCodeBlock filename="shipping.js" language="js" :highlight="highlight" :code="code" />
</template>

```

### Case: line-numbers

#### Vue
```vue
<script setup lang="ts">
import { ZCodeBlock } from '@zelviora/vue';

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

<template>
  <ZCodeBlock filename="package.json" language="json" line-numbers highlight-lines="4-6" :code="code" />
</template>

```

### Case: long

#### Vue
```vue
<script setup lang="ts">
import { ZCodeBlock, ZStack } from '@zelviora/vue';

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');
</script>

<template>
  <ZStack gap="md">
    <ZCodeBlock language="bash" :code="longLine" />
    <ZCodeBlock language="bash" wrap :code="longLine" />
    <ZCodeBlock filename="worker.log" line-numbers :code="log" />
  </ZStack>
</template>

```

### Case: tabs

#### Vue
```vue
<script setup lang="ts">
import { ZCodeBlock, ZTabs, ZTabsList, ZTabsPanel, ZTabsTrigger } from '@zelviora/vue';

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

<template>
  <ZTabs default-value="vue">
    <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>
</template>

```


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

## Documentation

# Code editor

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


## Examples & Implementation

### Case: basic

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZCodeEditor } from '@zelviora/vue';

const code = ref(`function greet(name: string): string {
  return \`Hello, \${name}!\`;
}`);
</script>

<template>
  <ZCodeEditor
    language="typescript"
    v-model="code"
  />
</template>

```

### Case: form

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZCodeEditor, ZStack } from '@zelviora/vue';

const submitted = ref<string | null>(null);

const handleSubmit = (e: Event) => {
  e.preventDefault();
  const form = e.currentTarget as HTMLFormElement;
  const data = new FormData(form);
  submitted.value = String(data.get('snippet') || '');
};
</script>

<template>
  <form class="demo-narrow" @submit="handleSubmit">
    <z-stack gap="md">
      <z-code-editor
        name="snippet"
        label="Configuration script"
        hint="Enter JSON or JavaScript config snippet."
        language="javascript"
        required
        value='{\n  "version": "1.0.0",\n  "enabled": true\n}'
      />
      <z-stack orientation="horizontal" wrap align-items="center" gap="sm">
        <z-button type="submit">Submit code</z-button>
        <output v-if="submitted">Submitted: {{ submitted.length }} chars</output>
      </z-stack>
    </z-stack>
  </form>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZCodeHighlighter } from '@zelviora/vue';

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

<template>
  <ZCodeHighlighter language="javascript" :value="code" />
</template>

```

### Case: line-numbers

#### Vue
```vue
<script setup lang="ts">
import { ZCodeHighlighter } from '@zelviora/vue';

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

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

<template>
  <ZCodeHighlighter language="typescript" line-numbers :value="code" />
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZCollapsible, ZCollapsibleContent, ZCollapsibleTrigger, ZInput, ZStack } from '@zelviora/vue';

const open = ref(false);
const log = ref<string[]>([]);

function onOpenChange(e: CustomEvent<{ open: boolean; reason: string }>) {
  open.value = e.detail.open;
  log.value.push(`${e.detail.open ? 'opened' : 'closed'} (${e.detail.reason})`);
}
</script>

<template>
  <ZStack gap="sm">
    <ZStack orientation="horizontal" gap="sm" align-items="center">
      <ZButton variant="outline" tone="neutral" @click="open = !open">Toggle from state</ZButton>
      <span>open: {{ open }}</span>
    </ZStack>
    <ZCollapsible :open="open" @z-open-change="onOpenChange">
      <ZCollapsibleTrigger>Advanced options</ZCollapsibleTrigger>
      <ZCollapsibleContent>
        <ZStack gap="sm">
          <ZInput label="Proxy server" name="proxy" />
          <ZInput label="Timeout (seconds)" name="timeout" />
        </ZStack>
      </ZCollapsibleContent>
    </ZCollapsible>
    <ul>
      <li v-for="(entry, i) in log" :key="i">{{ entry }}</li>
    </ul>
  </ZStack>
</template>

```

### Case: custom-indicator

#### Vue
```vue
<script setup lang="ts">
import { ZCollapsible, ZCollapsibleContent, ZCollapsibleTrigger, ZIcon, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZStack gap="md">
    <ZCollapsible default-open>
      <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>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ZCollapsible, ZCollapsibleContent, ZCollapsibleTrigger } from '@zelviora/vue';
</script>

<template>
  <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>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZColorPicker, ZStack } from '@zelviora/vue';

// An opacity slider; the value is always #rrggbbaa (8 digits).
const value = ref('#2563eb80');
</script>

<template>
  <ZStack class="demo-narrow">
    <ZColorPicker v-model="value" label="Overlay color" alpha />
    <span>Value: {{ value }}</span>
  </ZStack>
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZColorPicker, ZStack } from '@zelviora/vue';

// The app owns `value` (v-model, model event zInput on every drag step); the preview follows live and zChange is logged on commit.
const value = ref('#7c3aed');
const log = ref<string[]>([]);
const add = (line: string) => { log.value = [line, ...log.value].slice(0, 5); };

function onChange(e: CustomEvent<{ value: string }>) {
  add(`zChange ${e.detail.value}`);
}
function onOpen(e: CustomEvent<{ open: boolean; reason: string }>) {
  add(`zOpenChange ${e.detail.open} (${e.detail.reason})`);
}
</script>

<template>
  <ZStack class="demo-narrow">
    <ZColorPicker v-model="value" label="Background color" @z-change="onChange" @z-open-change="onOpen" />
    <ZColorPicker label="Preview" :value="value" readonly />
    <ZStack orientation="horizontal" gap="sm" wrap>
      <ZButton variant="outline" tone="neutral" @click="value = '#dc2626'">Set #dc2626</ZButton>
      <ZButton variant="outline" tone="neutral" @click="value = ''">Clear</ZButton>
    </ZStack>
    <span>Value: {{ value || "''" }}</span>
    <output>{{ log.join(' · ') }}</output>
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZColorPicker } from '@zelviora/vue';

// Component tokens resize the panel, the area and the swatches: see the `demo-color-picker-brand` rule in README.
const SWATCHES = ['#0f172a', '#2563eb', '#16a34a', '#f59e0b', '#dc2626', '#db2777'];
</script>

<template>
  <ZColorPicker class="demo-color-picker-brand" label="Tag color" inline value="#16a34a" :swatches="SWATCHES" />
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZColorPicker, ZStack } from '@zelviora/vue';

// Click the trigger: drag in the area, move the hue slider or type a hex code.
// v-model binds `value` through the model event `zInput` (every drag step).
const value = ref('#2563eb');
</script>

<template>
  <ZStack class="demo-narrow">
    <ZColorPicker v-model="value" label="Primary color" />
    <span>Value: {{ value || "''" }}</span>
  </ZStack>
</template>

```

### Case: form

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZColorPicker, ZField, ZStack } from '@zelviora/vue';

// Native form: the value is submitted as #rrggbb (FormData), required inside a field, reset restores defaults.
const sent = ref('');

function submit(e: Event) {
  sent.value = JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]);
}
</script>

<template>
  <form class="demo-narrow" @submit.prevent="submit">
    <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" value="#0d9488" />
      <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
        <ZButton type="submit">Submit</ZButton>
        <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
      </ZStack>
      <output v-if="sent">{{ sent }}</output>
    </ZStack>
  </form>
</template>

```

### Case: i18n

#### Vue
```vue
<script setup lang="ts">
import { ZColorPicker, ZConfigProvider, ZGrid } from '@zelviora/vue';

// Slider, area and button labels follow the locale; the panel is mirrored in RTL.
</script>

<template>
  <ZGrid columns="1 sm:3" gap="md">
    <ZConfigProvider locale="vi">
      <ZColorPicker label="Tiếng Việt" value="#2563eb" />
    </ZConfigProvider>
    <ZConfigProvider locale="en">
      <ZColorPicker label="English" value="#2563eb" />
    </ZConfigProvider>
    <div dir="rtl" lang="ar-EG">
      <ZColorPicker label="العربية" value="#2563eb" />
    </div>
  </ZGrid>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZColorPicker, ZGrid } from '@zelviora/vue';

// Empty (placeholder), filled, clearable, disabled, readonly and invalid; a status shown on the trigger.
</script>

<template>
  <ZGrid columns="1 sm:2" gap="md">
    <ZColorPicker label="Empty" placeholder="No color selected" />
    <ZColorPicker label="With value" value="#f97316" />
    <ZColorPicker label="Clearable" value="#f97316" clearable />
    <ZColorPicker label="Disabled" value="#f97316" disabled />
    <ZColorPicker label="Readonly" value="#f97316" readonly />
    <ZColorPicker label="Invalid" value="#f97316" invalid />
    <ZColorPicker label="Warning" value="#f97316" status="warning" />
    <ZColorPicker label="Success" value="#f97316" status="success" />
  </ZGrid>
</template>

```

### Case: swatches

#### Vue
```vue
<script setup lang="ts">
import { ZColorPicker, ZGrid } from '@zelviora/vue';

// Preset colors as a radio group (arrow keys move, Space/Enter picks); the selected swatch is announced.
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',
];
</script>

<template>
  <ZGrid columns="1 md:2" gap="md">
    <ZColorPicker label="Brand palette" inline value="#2563eb" :swatches="BRAND" />
    <ZColorPicker label="40 colors" value="#d92626" :swatches="MANY" />
  </ZGrid>
</template>

```

### Case: validation

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZColorPicker, ZStack } from '@zelviora/vue';

// A required color, and a wrong hex code (type "#12" then leave the field) that stays as bad input.
</script>

<template>
  <form class="demo-narrow" @submit.prevent>
    <ZStack>
      <ZColorPicker name="brand" label="Brand color" placeholder="No color selected" required />
      <ZColorPicker name="accent" label="Try an invalid hex code" value="#0ea5e9" hint='Type "#12" in the hex field, then Tab' />
      <ZButton type="submit">Submit</ZButton>
    </ZStack>
  </form>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZColorPicker, ZGrid, ZStack } from '@zelviora/vue';

// Outline and filled triggers in every size, and the panel in the flow (`inline`).
</script>

<template>
  <ZStack gap="lg">
    <ZGrid columns="1 sm:3" gap="md">
      <ZColorPicker label="Small" size="sm" value="#2563eb" />
      <ZColorPicker label="Medium" size="md" value="#2563eb" />
      <ZColorPicker label="Large" size="lg" value="#2563eb" />
      <ZColorPicker label="Small filled" size="sm" variant="filled" value="#16a34a" />
      <ZColorPicker label="Medium filled" size="md" variant="filled" value="#16a34a" />
      <ZColorPicker label="Large filled" size="lg" variant="filled" value="#16a34a" />
    </ZGrid>
    <ZColorPicker label="Inline" inline value="#db2777" />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZComboChart } from '@zelviora/vue-chart';
import { comboData, comboSeries } from '../data.ts';
</script>

<template>
  <ZComboChart
    heading="Revenue vs Operating Margin (%)"
    description="Quarterly revenue bars paired with a secondary-axis operating margin trend line."
    x-key="quarter" :data="comboData" :series="comboSeries"
  />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/vue';
import {
  ZComboChart,
  type ChartPointSelectDetail,
  type ChartSeriesToggleDetail,
} from '@zelviora/vue-chart';
import { comboData, comboSeries } from '../data.ts';

const hidden = ref<string[]>([]);
const selected = ref('Click any chart element to inspect');

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

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

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" gap="sm" align-items="center" wrap>
      <ZButton size="sm" variant="outline" @click="hidden = []">
        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."
      x-key="quarter" :data="comboData" :series="comboSeries"
      selectable
      :hidden-series="hidden"
      @z-series-toggle="onToggle"
      @z-point-select="onSelect"
    />
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZComboChart } from '@zelviora/vue-chart';
import { comboData, comboSeries } from '../data.ts';
</script>

<template>
  <ZComboChart
    class="demo-chart-brand"
    description="Quarterly revenue bars paired with a secondary-axis operating margin trend line."
    :value-format="{ maximumFractionDigits: 1 }"
    x-key="quarter" :data="comboData" :series="comboSeries" smooth data-zoom renderer="canvas"
  >
    <span slot="heading">Revenue vs Operating Margin (%) — Custom Theme Tokens &amp; Canvas</span>
  </ZComboChart>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZComboChart } from '@zelviora/vue-chart';
import { comboData, comboSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZComboChart
      heading="Loading State (aria-busy)"
      loading
      x-key="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."
      show-data-table
      x-key="quarter" :data="comboData" :series="comboSeries"
    />
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZComboChart } from '@zelviora/vue-chart';
import { comboData, comboSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZComboChart
      heading="Stacked Bars + Smooth Line"
      description="Stacked bars with smooth dual-axis line vs interactive dataZoom composite chart."
      x-key="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."
      x-key="quarter" :data="comboData" :series="comboSeries" data-zoom
    />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { computed, onBeforeUnmount, ref } from 'vue';
import { ZCombobox, ZStack } from '@zelviora/vue';

/** 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.
const query = ref('');
const page = ref(1);
const loading = ref(false);
let timer: ReturnType<typeof setTimeout> | undefined;
const results = computed(() => search(query.value));
const shown = computed(() => results.value.slice(0, page.value * PAGE));

function later(fn: () => void) {
  clearTimeout(timer);
  loading.value = true;
  timer = setTimeout(() => { fn(); loading.value = false; }, 300);
}
function onSearch(e: CustomEvent<{ query: string }>) {
  const q = e.detail.query;
  later(() => { query.value = q; page.value = 1; });
}
function onLoadMore() {
  if (page.value * PAGE < results.value.length) later(() => { page.value += 1; });
}
onBeforeUnmount(() => clearTimeout(timer));
</script>

<template>
  <ZStack class="demo-narrow">
    <ZCombobox
      label="Address"
      hint="Results come from the app; scroll to the end to load more"
      filter="none"
      :loading="loading"
      :options="shown"
      @z-search="onSearch"
      @z-load-more="onLoadMore"
    />
    <span>{{ results.length }} matches, {{ shown.length }} shown</span>
  </ZStack>
</template>

```

### Case: custom

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZCombobox, ZSelectOption, ZStack } from '@zelviora/vue';

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

// Custom value (allow-custom-value), matched text styled through ::part(item-match), custom empty content.
const job = ref<string | null>(null);
</script>

<template>
  <ZStack class="demo-narrow">
    <ZCombobox v-model="job" label="Occupation" hint="Type a job that is not listed, then Enter or leave the field" allow-custom-value clearable>
      <ZSelectOption v-for="j in JOBS" :key="j" :value="j">{{ j }}</ZSelectOption>
    </ZCombobox>
    <span>Value: {{ job ?? 'none' }}</span>
    <ZCombobox class="demo-combobox-match" label="Matched text underlined">
      <ZSelectOption v-for="j in JOBS" :key="j" :value="j">{{ j }}</ZSelectOption>
      <span slot="empty">No job matches; try "eng"</span>
    </ZCombobox>
  </ZStack>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZCombobox, ZSelectOption, ZStack } from '@zelviora/vue';

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". v-model binds `value` (zChange).
const value = ref<string | null>('dn');
const log = ref<string[]>([]);
const add = (line: string) => { log.value = [line, ...log.value].slice(0, 4); };

function onChange(e: CustomEvent<{ value: string | null }>) {
  add(`zChange ${e.detail.value}`);
}
function onSearch(e: CustomEvent<{ query: string }>) {
  add(`zSearch ${e.detail.query}`);
}
</script>

<template>
  <ZStack class="demo-narrow">
    <ZCombobox
      v-model="value"
      label="City"
      hint='Type part of a name, for example "lis"'
      placeholder="Type to search"
      clearable
      @z-change="onChange"
      @z-search="onSearch"
    >
      <ZSelectOption v-for="[v, l] in PROVINCES" :key="v" :value="v">{{ l }}</ZSelectOption>
    </ZCombobox>
    <span>Value: {{ value ?? 'none' }}</span>
    <output>{{ log.join(' · ') }}</output>
  </ZStack>
</template>

```

### Case: form

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZCombobox, ZField, ZSelectOption, ZStack } from '@zelviora/vue';

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.
const sent = ref('');

function submit(e: Event) {
  sent.value = JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]);
}
</script>

<template>
  <form class="demo-narrow" @submit.prevent="submit">
    <ZStack>
      <ZField label="City" hint="Required" required>
        <ZCombobox name="province" required placeholder="Type to search">
          <ZSelectOption v-for="[v, l] in PROVINCES" :key="v" :value="v">{{ l }}</ZSelectOption>
        </ZCombobox>
      </ZField>
      <ZCombobox name="hometown" label="Hometown" value="hue">
        <ZSelectOption v-for="[v, l] in PROVINCES" :key="v" :value="v">{{ l }}</ZSelectOption>
      </ZCombobox>
      <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
        <ZButton type="submit">Submit</ZButton>
        <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
      </ZStack>
      <output v-if="sent">{{ sent }}</output>
    </ZStack>
  </form>
</template>

```

### Case: i18n

#### Vue
```vue
<script setup lang="ts">
import { ZCombobox, ZConfigProvider } from '@zelviora/vue';
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.
</script>

<template>
  <ZConfigProvider locale="vi">
    <div class="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>
</template>

```

### Case: large

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZCombobox, ZStack } from '@zelviora/vue';

// 5 000 options as data: the list is virtual (`virtual="auto"` above 200 options), only the rows in view are rendered.
const products = Array.from({ length: 5000 }, (_, i) => ({ value: `sku-${i + 1}`, label: `Product ${i + 1}` }));
const value = ref<string | null>(null);
</script>

<template>
  <ZStack class="demo-narrow">
    <ZCombobox v-model="value" label="Product" placeholder="Type a number, for example 4321" :options="products" clearable />
    <span>Value: {{ value ?? 'none' }}</span>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZCommandGroup, ZCommandItem, ZCommandPalette, ZStack, ZText } from '@zelviora/vue';

// Dialog opened by its trigger or the Mod+K hotkey (off unless set).
const last = ref('nothing yet');
</script>

<template>
  <ZStack orientation="horizontal" wrap align-items="center" gap="md">
    <ZCommandPalette hotkey="Mod+K" @z-select="last = $event.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>
</template>

```

### Case: i18n

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZCommandGroup, ZCommandItem, ZCommandPalette } from '@zelviora/vue';

// `lang="vi"`: labels and built-in texts are Vietnamese; "dong" matches "Đóng tab".
</script>

<template>
  <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>
</template>

```

### Case: inline

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZCommandPalette } from '@zelviora/vue';

// Inline search with results from a (fake) server: zSearch is debounced, loading shows a spinner, no client filter.
interface Item { value: string; label: string; group?: string; keywords?: string[]; shortcut?: string }
const ALL: Item[] = [
  { 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' },
];
const items = ref<Item[]>(ALL);
const loading = ref(false);

function onSearch(e: CustomEvent<{ query: string }>) {
  const q = e.detail.query.trim().toLowerCase();
  loading.value = true;
  setTimeout(() => {
    items.value = ALL.filter((i) => !q || i.label.toLowerCase().includes(q) || i.keywords?.some((k) => k.includes(q)));
    loading.value = false;
  }, 400);
}
</script>

<template>
  <div class="demo-narrow">
    <ZCommandPalette inline label="Search the workspace" disable-filter :items="items" :loading="loading" @z-search="onSearch">
      <span slot="empty">Nothing found. Try “clients”.</span>
    </ZCommandPalette>
  </div>
</template>

```


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

## Documentation

# Condition Builder Angular Demos

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


## Examples & Implementation

### Case: basic

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import {
  ZButton,
  ZConditionBuilder,
  ZConditionBuilderExpression,
  ZConditionBuilderPredicate,
  ZIcon,
  ZIconButton,
  ZInput,
  ZText,
} from '@zelviora/vue';

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

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

function addCondition() {
  conditions.value.push({
    id: String(Date.now()),
    field: 'Custom filter',
    operator: 'eq',
    value: '',
  });
}

function removeCondition(id: string) {
  conditions.value = conditions.value.filter((c) => c.id !== id);
}

function updateOperator(id: string, operator: string) {
  const item = conditions.value.find((c) => c.id === id);
  if (item) item.operator = operator;
}

function updateValue(id: string, e: CustomEvent) {
  const item = conditions.value.find((c) => c.id === id);
  if (item) item.value = (e.target as HTMLInputElement)?.value ?? '';
}
</script>

<template>
  <ZConditionBuilder>
    <ZConditionBuilderPredicate condition-operator="and" :vertical="true">
      <ZText v-if="conditions.length === 0" variant="muted" size="sm">No conditions defined.</ZText>

      <ZConditionBuilderExpression
        v-for="item in conditions"
        :key="item.id"
        :operators="OPERATORS"
        :operator-value="item.operator"
        @z-operator-change="(e: any) => updateOperator(item.id, e.detail.value)"
      >
        <ZInput
          :placeholder="`Enter ${item.field.toLowerCase()}`"
          :value="item.value"
          class="demo-cb-input"
          @z-input="(e: any) => updateValue(item.id, e)"
        />
        <ZIconButton
          label="Delete condition"
          variant="ghost"
          tone="destructive"
          size="sm"
          @click="removeCondition(item.id)"
        >
          <ZIcon name="delete" />
        </ZIconButton>
      </ZConditionBuilderExpression>

      <div slot="end">
        <ZButton size="sm" variant="outline" @click="addCondition">
          <ZIcon slot="icon-start" name="add" />
          Add condition
        </ZButton>
      </div>
    </ZConditionBuilderPredicate>
  </ZConditionBuilder>
</template>

```

### Case: nested

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import {
  ZButton,
  ZConditionBuilder,
  ZConditionBuilderCompoundExpression,
  ZConditionBuilderExpression,
  ZConditionBuilderPredicate,
  ZIcon,
  ZIconButton,
  ZInput,
  ZNumberInput,
} from '@zelviora/vue';

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

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

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

function addAgeRule() {
  ageRules.value.push({
    id: `age-${Date.now()}`,
    operator: 'gt',
    value: 21,
  });
}

function removeAgeRule(id: string) {
  ageRules.value = ageRules.value.filter((r) => r.id !== id);
}

function addDeptRule() {
  deptRules.value.push({
    id: `dept-${Date.now()}`,
    operator: 'eq',
    value: '',
  });
}

function removeDeptRule(id: string) {
  deptRules.value = deptRules.value.filter((r) => r.id !== id);
}
</script>

<template>
  <ZConditionBuilder>
    <ZConditionBuilderPredicate condition-operator="and" :vertical="true">
      <ZConditionBuilderCompoundExpression
        v-if="ageRules.length > 0"
        field-label="Age"
        field-name="age"
        condition-operator="or"
      >
        <ZConditionBuilderExpression
          v-for="rule in ageRules"
          :key="rule.id"
          :operators="NUM_OPS"
          :operator-value="rule.operator"
        >
          <ZNumberInput :value="rule.value" class="demo-cb-number" />
          <ZIconButton
            label="Delete condition"
            variant="ghost"
            tone="destructive"
            size="sm"
            @click="removeAgeRule(rule.id)"
          >
            <ZIcon name="delete" />
          </ZIconButton>
        </ZConditionBuilderExpression>

        <div slot="end">
          <ZButton size="sm" variant="ghost" @click="addAgeRule">
            <ZIcon slot="icon-start" name="add" />
            Add age rule
          </ZButton>
        </div>
      </ZConditionBuilderCompoundExpression>

      <ZConditionBuilderCompoundExpression
        v-if="deptRules.length > 0"
        field-label="Department"
        field-name="dept"
        condition-operator="or"
      >
        <ZConditionBuilderExpression
          v-for="rule in deptRules"
          :key="rule.id"
          :operators="STRING_OPS"
          :operator-value="rule.operator"
        >
          <ZInput
            placeholder="Department name"
            :value="rule.value"
            class="demo-cb-input"
          />
          <ZIconButton
            label="Delete condition"
            variant="ghost"
            tone="destructive"
            size="sm"
            @click="removeDeptRule(rule.id)"
          >
            <ZIcon name="delete" />
          </ZIconButton>
        </ZConditionBuilderExpression>

        <div slot="end">
          <ZButton size="sm" variant="ghost" @click="addDeptRule">
            <ZIcon slot="icon-start" name="add" />
            Add department rule
          </ZButton>
        </div>
      </ZConditionBuilderCompoundExpression>
    </ZConditionBuilderPredicate>
  </ZConditionBuilder>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZConfigProvider, ZSpinner, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZConfigProvider>
    <ZStack orientation="horizontal" align-items="center" gap="md" wrap>
      <ZButton>Save</ZButton>
      <ZButton variant="outline" tone="neutral">Cancel</ZButton>
      <ZSpinner show-label />
    </ZStack>
  </ZConfigProvider>
</template>

```

### Case: contrast

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZCard, ZConfigProvider, ZGrid, ZInput, ZStack } from '@zelviora/vue';

// `contrast="more"` next to the default region; it changes colors only when the brand enables theme.highContrast.
const regions = [undefined, 'more'] as const;
</script>

<template>
  <ZGrid columns="1 sm:2" gap="md" align-items="start">
    <ZConfigProvider v-for="contrast in regions" :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>
</template>

```

### Case: density

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZConfigProvider, ZStack, ZTable } from '@zelviora/vue';

const columns = [
  { key: 'task', header: 'Task' },
  { key: 'owner', header: 'Owner' },
];
const rows = [
  { key: '1', task: 'Review', owner: 'An' },
  { key: '2', task: 'Deploy', owner: 'Binh' },
];
const densities = ['compact', 'default', 'comfortable'] as const;
</script>

<template>
  <ZStack gap="lg">
    <ZConfigProvider v-for="density in densities" :key="density" :density="density">
      <ZStack gap="sm" align-items="start">
        <ZButton>{{ density }}</ZButton>
        <ZTable :caption="`Tasks (${density})`" :columns="columns" :rows="rows" />
      </ZStack>
    </ZConfigProvider>
  </ZStack>
</template>

```

### Case: disabled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZConfigProvider, ZInput, ZSelect, ZSelectOption, ZStack, ZSwitch } from '@zelviora/vue';

// `disabled` turns the whole region off like a disabled fieldset: no focus, no submit; the toggle stays outside.
const disabled = ref(true);
const sent = ref('');

function submit(e: Event) {
  sent.value = JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]);
}
</script>

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" gap="sm" align-items="center" wrap>
      <ZButton variant="outline" tone="neutral" @click="disabled = !disabled">
        {{ disabled ? 'Enable region' : 'Disable region' }}
      </ZButton>
      <span>disabled: {{ String(disabled) }}</span>
    </ZStack>
    <ZConfigProvider :disabled="disabled">
      <form class="demo-narrow" @submit.prevent="submit">
        <ZStack>
          <ZInput label="Full name" name="name" value="An Nguyen" />
          <ZSelect label="Plan" name="plan" value="team">
            <ZSelectOption value="starter">Starter</ZSelectOption>
            <ZSelectOption value="team">Team</ZSelectOption>
          </ZSelect>
          <ZSwitch name="newsletter" checked>Newsletter</ZSwitch>
          <ZButton type="submit">Submit</ZButton>
          <output v-if="sent">{{ sent }}</output>
        </ZStack>
      </form>
    </ZConfigProvider>
  </ZStack>
</template>

```

### Case: form

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZConfigProvider, ZField, ZInput, ZSelect, ZSelectOption, ZStack } from '@zelviora/vue';

// A native form inside a provider with locale="en": required fields report built-in English messages on submit.
const sent = ref('');

function submit(e: Event) {
  sent.value = JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]);
}
</script>

<template>
  <ZConfigProvider locale="en">
    <form class="demo-narrow" @submit.prevent="submit">
      <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 align-items="center" gap="sm">
          <ZButton type="submit">Submit</ZButton>
          <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
        </ZStack>
        <output v-if="sent">{{ sent }}</output>
      </ZStack>
    </form>
  </ZConfigProvider>
</template>

```

### Case: i18n

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZCard, ZConfigProvider, ZGrid, ZInput, ZStack } from '@zelviora/vue';

// The provider locale drives built-in strings: submit an empty form to see the validation message in each language.
</script>

<template>
  <ZGrid columns="1 sm:2" gap="md" align-items="start">
    <ZConfigProvider locale="en">
      <ZCard heading="English">
        <form @submit.prevent>
          <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 @submit.prevent>
          <ZStack gap="sm">
            <ZInput label="Họ và tên" name="name" required />
            <ZButton type="submit">Gửi</ZButton>
          </ZStack>
        </form>
      </ZCard>
    </ZConfigProvider>
  </ZGrid>
</template>

```

### Case: messages

#### Vue
```vue
<script setup lang="ts">
import { ZConfigProvider, ZSpinner, ZStack, ZTable } from '@zelviora/vue';

/** `messages` overrides library strings by key for the subtree (merged with ancestor providers). */
const messages = {
  'spinner.loading': 'Fetching your data',
  'table.empty': 'Nothing to show yet',
};
const columns = [{ key: 'name', header: 'Name' }];
</script>

<template>
  <ZConfigProvider :messages="messages">
    <ZStack gap="md">
      <ZSpinner show-label />
      <ZTable caption="Results" :columns="columns" :rows="[]" />
    </ZStack>
  </ZConfigProvider>
</template>

```

### Case: motion

#### Vue
```vue
<script setup lang="ts">
import { ZCard, ZCollapsible, ZCollapsibleContent, ZCollapsibleTrigger, ZConfigProvider, ZGrid } from '@zelviora/vue';

// `motion="reduce"` applies the reduced-motion tokens to its region only: its collapsible opens without animation.
</script>

<template>
  <ZGrid columns="1 sm:2" gap="md" align-items="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>
</template>

```

### Case: nested

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZCard, ZConfigProvider, ZGrid, ZGridItem, ZStack, ZTable } from '@zelviora/vue';

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.
</script>

<template>
  <ZConfigProvider theme="light">
    <ZGrid :columns="4" align-items="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>
</template>

```

### Case: playground

#### Vue
```vue
<script setup lang="ts">
import { computed, reactive, ref } from 'vue';
import {
  ZButton,
  ZCard,
  ZCollapsible,
  ZCollapsibleContent,
  ZCollapsibleTrigger,
  ZConfigProvider,
  ZDatePicker,
  ZGrid,
  ZInput,
  ZSelect,
  ZSelectOption,
  ZStack,
  ZSwitch,
} from '@zelviora/vue';

// Every provider prop driven by controls built with library components, around one small sample form.
// 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 = 'theme' | 'density' | 'size' | 'variant' | 'locale' | 'dir';
const config = reactive(Object.fromEntries(selects.map((s) => [s.key, s.options[0]])) as Record<SelectKey, string | null>);
const disabled = ref(false);
const reduceMotion = ref(false);
const moreContrast = ref(false);
const provider = computed(() => ({
  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 ?? undefined,
  dir: config.dir ?? undefined,
  disabled: disabled.value,
  motion: reduceMotion.value ? ('reduce' as const) : undefined,
  contrast: moreContrast.value ? ('more' as const) : undefined,
}));
</script>

<template>
  <ZStack gap="lg">
    <ZGrid columns="2 sm:3" gap="md">
      <ZSelect v-for="s in selects" :key="s.key" v-model="config[s.key]" :label="s.label" size="sm">
        <ZSelectOption v-for="o in s.options" :key="o" :value="o">{{ o }}</ZSelectOption>
      </ZSelect>
    </ZGrid>
    <ZStack orientation="horizontal" gap="md" wrap>
      <ZSwitch v-model="disabled">Disabled</ZSwitch>
      <ZSwitch v-model="reduceMotion">Reduce motion</ZSwitch>
      <ZSwitch v-model="moreContrast">More contrast</ZSwitch>
    </ZStack>
    <ZConfigProvider v-bind="provider">
      <ZCard heading="Sample form">
        <form class="demo-narrow" @submit.prevent>
          <ZStack>
            <ZInput label="Full name" name="name" required />
            <ZSelect label="Plan" name="plan" value="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" value="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>
</template>

```

### Case: preset

#### Vue
```vue
<script setup lang="ts">
import { ZBadge, ZButton, ZCard, ZConfigProvider, ZGrid, ZInput, ZStack } from '@zelviora/vue';
import type { PresetName } from '@zelviora/vue';

// Theme presets per region: the same controls take the colors, radius, font and heights of each preset.
// 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' },
];
</script>

<template>
  <ZGrid columns="1 sm:3" gap="md">
    <ZConfigProvider v-for="r in regions" :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>
</template>

```

### Case: rtl

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZConfigProvider, ZIcon, ZStack, ZTable } from '@zelviora/vue';

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.
</script>

<template>
  <ZConfigProvider dir="rtl" lang="ar">
    <ZStack gap="md" align-items="start">
      <ZButton>
        <ZIcon slot="icon-start" name="arrow_back" />
        حفظ
      </ZButton>
      <ZTable caption="الطلبات" :columns="columns" :rows="rows" />
    </ZStack>
  </ZConfigProvider>
</template>

```

### Case: runtime

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZCard, ZConfigProvider, ZSpinner, ZStack, ZTable } from '@zelviora/vue';

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. */
const locale = ref<'en' | 'ar'>('en');
const theme = ref<'light' | 'dark'>('light');
</script>

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" gap="sm" wrap>
      <ZButton variant="outline" tone="neutral" @click="locale = locale === 'en' ? 'ar' : 'en'">Locale: {{ locale }}</ZButton>
      <ZButton variant="outline" tone="neutral" @click="theme = 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 show-label />
          <ZTable caption="Order" :columns="columns" :rows="rows" />
          <ZTable caption="Empty order" :columns="columns" :rows="[]" />
        </ZStack>
      </ZCard>
    </ZConfigProvider>
  </ZStack>
</template>

```

### Case: sizes

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZConfigProvider, ZStack } from '@zelviora/vue';

const sizes = ['sm', 'md', 'lg'] as const;
</script>

<template>
  <ZStack gap="md" align-items="start">
    <ZConfigProvider v-for="size in sizes" :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>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZConfigProvider, ZDatePicker, ZInput, ZSelect, ZSelectOption, ZStack } from '@zelviora/vue';

// `variant="filled"` is the default of every descendant field; a field with its own variant keeps it.
</script>

<template>
  <ZConfigProvider variant="filled">
    <ZStack class="demo-narrow">
      <ZInput label="Full name" value="An Nguyen" />
      <ZSelect label="Plan" value="team">
        <ZSelectOption value="starter">Starter</ZSelectOption>
        <ZSelectOption value="team">Team</ZSelectOption>
      </ZSelect>
      <ZDatePicker label="Start date" today="2026-10-02" value="2026-10-15" />
      <ZInput label="Own variant outline" variant="outline" value="Keeps its outline" />
    </ZStack>
  </ZConfigProvider>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
// Default: at most 64rem wide (lg), centered, with md inline padding.
import { ZContainer } from '@zelviora/vue';
</script>

<template>
  <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>
</template>

```

### Case: composition

#### Vue
```vue
<script setup lang="ts">
// The grid columns follow the container (md, 48rem): three columns from sm, one when the container is narrower.
import { ZCard, ZContainer, ZGrid } from '@zelviora/vue';

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

<template>
  <ZContainer size="md">
    <ZGrid columns="1 sm:3">
      <ZCard v-for="s in stats" :key="s.heading" :heading="s.heading" size="sm">{{ s.value }}</ZCard>
    </ZGrid>
  </ZContainer>
</template>

```

### Case: landmark

#### Vue
```vue
<script setup lang="ts">
// landmark-role sets the role on the host; a region needs a label.
import { ZContainer, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZContainer size="sm" landmark-role="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>
</template>

```

### Case: sizes

#### Vue
```vue
<script setup lang="ts">
// Maximum widths: sm 40rem, md 48rem, lg 64rem, xl 80rem, full without limit.
import { ZCard, ZContainer, ZStack } from '@zelviora/vue';

const sizes = ['sm', 'md', 'lg', 'xl', 'full'] as const;
</script>

<template>
  <ZStack gap="sm">
    <ZContainer v-for="size in sizes" :key="size" :size="size" padding="none">
      <ZCard variant="soft" size="sm">size="{{ size }}"</ZCard>
    </ZContainer>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZContextMenu, ZMenuItem, ZStack } from '@zelviora/vue';

// 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.
const menu = ref<{ $el: HTMLElement & { showAt(x: number, y: number): Promise<void> } } | null>(null);
const open = ref(false);
const file = ref('');

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

function showFrom(e: MouseEvent) {
  const r = (e.currentTarget as HTMLElement).getBoundingClientRect();
  void menu.value?.$el.showAt(r.left, r.bottom);
}
</script>

<template>
  <ZStack gap="md">
    <ZContextMenu ref="menu" label="Row actions" :open="open" @z-open-change="open = $event.detail.open" @z-before-open="onBeforeOpen">
      <ZStack slot="target" gap="xs" class="demo-context-area">
        <span data-file="a.txt" tabindex="0">a.txt</span>
        <span data-file="b.txt" tabindex="0">b.txt</span>
        <span>(empty space: browser menu)</span>
      </ZStack>
      <ZMenuItem value="open">Open {{ file }}</ZMenuItem>
      <ZMenuItem value="delete" tone="destructive">Delete {{ file }}</ZMenuItem>
    </ZContextMenu>
    <ZStack orientation="horizontal" wrap align-items="center" gap="md">
      <ZButton variant="outline" tone="neutral" @click="showFrom">showAt()</ZButton>
      <span>{{ open ? 'Open' : 'Closed' }}</span>
    </ZStack>
    <ZContextMenu label="Disabled" disabled>
      <div slot="target" class="demo-context-area">Disabled: the browser menu shows</div>
      <ZMenuItem value="never">Never shown</ZMenuItem>
    </ZContextMenu>
  </ZStack>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZContextMenu, ZMenuItem, ZMenuSeparator, ZStack } from '@zelviora/vue';

// Right click, long-press (touch) or focus the area and press Shift+F10 / the Menu key.
const last = ref('');
</script>

<template>
  <ZStack gap="sm">
    <ZContextMenu label="File actions" @z-select="last = $event.detail.value">
      <div slot="target" tabindex="0" class="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>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import {
  ZContextMenu, ZMenuCheckboxItem, ZMenuItem, ZMenuLabel, ZMenuRadioGroup, ZMenuRadioItem, ZMenuSeparator, ZMenuSub, ZStack,
} from '@zelviora/vue';

// Checkbox and radio items (v-model), a submenu; the menu flips near the viewport edges.
const grid = ref(true);
const zoom = ref('100');
</script>

<template>
  <ZStack gap="sm">
    <ZContextMenu label="Canvas">
      <div slot="target" tabindex="0" class="demo-context-area">Canvas — right click near the edges too</div>
      <ZMenuCheckboxItem v-model="grid" keep-open-on-select>Show grid</ZMenuCheckboxItem>
      <ZMenuSeparator />
      <ZMenuRadioGroup v-model="zoom">
        <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>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { computed, ref } from 'vue';
import { ZCropper, ZSegmented, ZSegmentedItem, ZStack } from '@zelviora/vue';
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).
const preset = ref<string>(aspectDefault);
const option = computed(() => aspectOption(preset.value));
</script>

<template>
  <ZStack gap="sm" class="demo-narrow">
    <ZSegmented v-model="preset" :label="aspectLabel">
      <ZSegmentedItem v-for="o in aspectOptions" :key="o.value" :value="o.value">{{ o.label }}</ZSegmentedItem>
    </ZSegmented>
    <ZCropper :src="sampleImage" :alt="sampleAlt" :aspect-ratio="option.aspectRatio" :shape="option.shape" disable-rotate />
  </ZStack>
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { onBeforeUnmount, ref } from 'vue';
import { ZButton, ZCropper, ZGrid, ZStack, ZText } from '@zelviora/vue';
import {
  controlledInitial, controlledPresets, previewAlt, previewEmpty, previewHeading, previewMaxWidth, sampleAlt, sampleImage,
  valueLog, type CropArea,
} from '../data.ts';

type CropperElement = HTMLElement & { getCroppedBlob(options?: { type?: string; quality?: number; maxWidth?: number }): Promise<Blob> };

// v-model binds `value` (pixels of the original image) through `zInput`; `zChange` refreshes a preview.
const cropper = ref<{ $el: CropperElement } | null>(null);
const value = ref<CropArea>(controlledInitial);
const preview = ref<string>();

function revoke() {
  if (preview.value) URL.revokeObjectURL(preview.value);
}
async function refresh() {
  const blob = await cropper.value?.$el.getCroppedBlob({ maxWidth: previewMaxWidth }).catch(() => undefined);
  if (!blob) return;
  revoke();
  preview.value = URL.createObjectURL(blob);
}
// Wheel and pinch zoom commit through `zChange` only: copy its value too.
function onChange(e: CustomEvent<{ value: CropArea }>) {
  value.value = e.detail.value;
  void refresh();
}
onBeforeUnmount(revoke);
</script>

<template>
  <ZGrid columns="1 sm:2" gap="lg">
    <ZStack gap="sm">
      <ZStack orientation="horizontal" gap="sm" wrap>
        <ZButton v-for="p in controlledPresets" :key="p.label" size="sm" variant="outline" tone="neutral" @click="value = p.value">{{ p.label }}</ZButton>
      </ZStack>
      <ZCropper ref="cropper" v-model="value" :src="sampleImage" :alt="sampleAlt" @z-change="onChange" @z-load="refresh" />
    </ZStack>
    <ZStack gap="sm">
      <ZText variant="strong">{{ previewHeading }}</ZText>
      <img v-if="preview" :src="preview" :alt="previewAlt" />
      <ZText v-else variant="muted">{{ previewEmpty }}</ZText>
      <ZText variant="muted" size="sm">{{ valueLog(value) }}</ZText>
    </ZStack>
  </ZGrid>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZCropper, ZStack, ZText } from '@zelviora/vue';
import { changeLog, emptyLog, loadLog, sampleAlt, sampleImage, type CropArea } 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.
const log = ref(emptyLog);

function onLoad(e: CustomEvent<{ naturalWidth: number; naturalHeight: number }>) {
  log.value = loadLog(e.detail.naturalWidth, e.detail.naturalHeight);
}
function onChange(e: CustomEvent<{ value: CropArea }>) {
  log.value = changeLog(e.detail.value);
}
</script>

<template>
  <ZStack gap="sm" class="demo-narrow">
    <ZCropper :src="sampleImage" :alt="sampleAlt" @z-load="onLoad" @z-change="onChange" />
    <ZText variant="muted" size="sm">{{ log }}</ZText>
  </ZStack>
</template>

```

### Case: toolbar

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZButtonGroup, ZCropper, ZStack, ZText } from '@zelviora/vue';
import {
  emptyLog, exportLog, exportType, rotateStep, sampleAlt, sampleImage, toolbarButtons, toolbarLabel, toolbarLog, zoomStep,
  type CropArea,
} from '../data.ts';

type CropperElement = HTMLElement & {
  value?: CropArea;
  zoomTo(zoom: number): Promise<void>;
  rotateTo(degrees: number): Promise<void>;
  reset(): Promise<void>;
  getCroppedBlob(options?: { type?: string; quality?: number; maxWidth?: number }): Promise<Blob>;
};

// The `toolbar` slot replaces the default buttons: zoomTo() / rotateTo() change the view (clamped to minZoom..maxZoom,
// quarter turns; both emit zInput and zChange), reset() returns to the default and getCroppedBlob() exports the area.
const cropper = ref<{ $el: CropperElement } | null>(null);
const area = ref<CropArea>();
const exported = ref(emptyLog);

function onLoad() {
  area.value = cropper.value?.$el.value;
}
function onInput(e: CustomEvent<{ value: CropArea }>) {
  area.value = e.detail.value;
}
function zoom(step: number) {
  void cropper.value?.$el.zoomTo((area.value?.zoom ?? 1) + step);
}
function rotate() {
  void cropper.value?.$el.rotateTo((area.value?.rotate ?? 0) + rotateStep);
}
async function reset() {
  await cropper.value?.$el.reset();
  area.value = cropper.value?.$el.value;
}
async function exportArea() {
  const blob = await cropper.value?.$el.getCroppedBlob({ type: exportType }).catch(() => undefined);
  exported.value = exportLog(blob);
}
</script>

<template>
  <ZStack gap="sm" class="demo-narrow">
    <ZCropper ref="cropper" :src="sampleImage" :alt="sampleAlt" @z-load="onLoad" @z-input="onInput" @z-change="onInput">
      <ZButtonGroup slot="toolbar" :label="toolbarLabel">
        <ZButton size="sm" variant="outline" tone="neutral" @click="zoom(-zoomStep)">{{ toolbarButtons.zoomOut }}</ZButton>
        <ZButton size="sm" variant="outline" tone="neutral" @click="zoom(zoomStep)">{{ toolbarButtons.zoomIn }}</ZButton>
        <ZButton size="sm" variant="outline" tone="neutral" @click="rotate">{{ toolbarButtons.rotate }}</ZButton>
        <ZButton size="sm" variant="outline" tone="neutral" @click="reset">{{ toolbarButtons.reset }}</ZButton>
        <ZButton size="sm" @click="exportArea">{{ toolbarButtons.export }}</ZButton>
      </ZButtonGroup>
    </ZCropper>
    <ZText variant="muted" size="sm">{{ toolbarLog(area, exported) }}</ZText>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZCustomChart } from '@zelviora/vue-chart';
import { slaData, slaSeries } from '../data.ts';
</script>

<template>
  <ZCustomChart
    heading="Quarterly SLA Target vs Actual Performance"
    description="Bespoke custom series comparing actual availability scores against target baselines."
    x-key="quarter" :data="slaData" :series="slaSeries"
  />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/vue';
import {
  ZCustomChart,
  type ChartPointSelectDetail,
  type ChartSeriesToggleDetail,
} from '@zelviora/vue-chart';
import { slaData, slaSeries } from '../data.ts';

const hidden = ref<string[]>([]);
const selected = ref('Click any chart element to inspect');

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

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

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" gap="sm" align-items="center" wrap>
      <ZButton size="sm" variant="outline" @click="hidden = []">
        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."
      x-key="quarter" :data="slaData" :series="slaSeries"
      selectable
      :hidden-series="hidden"
      @z-series-toggle="onToggle"
      @z-point-select="onSelect"
    />
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZCustomChart } from '@zelviora/vue-chart';
import { slaData, slaSeries } from '../data.ts';
</script>

<template>
  <ZCustomChart
    class="demo-chart-brand"
    description="Bespoke custom series comparing actual availability scores against target baselines."
    :value-format="{ maximumFractionDigits: 1 }"
    x-key="quarter" :data="slaData" :series="slaSeries" data-zoom renderer="canvas"
  >
    <span slot="heading">Quarterly SLA Target vs Actual Performance — Custom Theme Tokens &amp; Canvas</span>
  </ZCustomChart>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZCustomChart } from '@zelviora/vue-chart';
import { slaData, slaSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZCustomChart
      heading="Loading State (aria-busy)"
      loading
      x-key="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."
      show-data-table
      x-key="quarter" :data="slaData" :series="slaSeries"
    />
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZCustomChart } from '@zelviora/vue-chart';
import { slaData, slaSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZCustomChart
      heading="Zoomable Custom Series"
      description="Interactive dataZoom custom series vs point-tooltip inspection mode."
      x-key="quarter" :data="slaData" :series="slaSeries" data-zoom
    />
    <ZCustomChart
      heading="Point Tooltip Mode"
      description="Interactive dataZoom custom series vs point-tooltip inspection mode."
      x-key="quarter" :data="slaData" :series="slaSeries" tooltip-mode="point"
    />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZConfigProvider, ZDataTable, ZStack } from '@zelviora/vue';
import { basicColumns, makeOrders } from '../data.ts';

const rows = makeOrders(4);
</script>

<template>
  <ZStack gap="lg">
    <ZDataTable label="Small, striped" size="sm" striped row-header="code" :columns="basicColumns" :rows="rows" />
    <ZDataTable label="Medium, bordered" bordered row-header="code" :columns="basicColumns" :rows="rows" />
    <ZDataTable label="Large, striped and bordered" size="lg" striped bordered row-header="code" :columns="basicColumns" :rows="rows" />
    <ZConfigProvider density="compact">
      <ZDataTable label="Compact density" row-header="code" :columns="basicColumns" :rows="rows" />
    </ZConfigProvider>
  </ZStack>
</template>

```

### Case: basic

#### Vue
```vue
<script setup lang="ts">
import { ZDataTable } from '@zelviora/vue';
import { basicColumns, makeOrders } from '../data.ts';

const rows = makeOrders(50);
</script>

<template>
  <!-- Click a header or press Enter on it to sort; arrows, Home/End and PageUp/PageDown move the focused cell. -->
  <ZDataTable label="Orders" row-header="code" :columns="basicColumns" :rows="rows" :page-size="10" />
</template>

```

### Case: clipboard-export

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZDataTable, ZStack } from '@zelviora/vue';
import { editableColumns, makeOrders, type Order } from '../data.ts';

type TableEl = HTMLElement & { exportCsv(opts?: { fileName?: string; onlySelected?: boolean }): Promise<void> };

const tableRef = ref<{ $el: TableEl } | null>(null);
const rows = ref<Order[]>(makeOrders(10));
const selected = ref<string[]>(['o1', 'o2']);
const status = ref('Select rows to view sum/avg metrics in the status bar, or right-click a cell.');

function onSelection(e: CustomEvent<{ value: string[] }>) {
  selected.value = e.detail.value;
}

function onCopy(e: CustomEvent<{ rowKeys: string[] }>) {
  status.value = `Copied ${e.detail.rowKeys.length} row(s) to clipboard.`;
}

function onPaste(e: CustomEvent<{ rowKey: string; column: string }>) {
  status.value = `Pasted clipboard data starting at ${e.detail.rowKey} (${e.detail.column}).`;
}

function onCellChange(e: CustomEvent<{ rowKey: string; column: string; value: unknown }>) {
  const { rowKey, column, value } = e.detail;
  rows.value = rows.value.map((r) => (r.key === rowKey ? { ...r, [column]: value } : r));
}
</script>

<template>
  <!-- Context menu, TSV clipboard copy/paste, status bar aggregations and RFC 4180 CSV export. -->
  <ZStack gap="sm">
    <ZDataTable
      ref="tableRef"
      label="Orders with clipboard and CSV export"
      row-header="code"
      selection-mode="multiple"
      status-bar
      context-menu
      searchable
      :page-size="0"
      :columns="editableColumns"
      :rows="rows"
      :selected-keys="selected"
      @z-selection-change="onSelection"
      @z-copy="onCopy"
      @z-paste="onPaste"
      @z-cell-change="onCellChange"
    >
      <ZButton slot="toolbar" size="sm" variant="outline" tone="neutral" @click="tableRef?.$el.exportCsv({ fileName: 'orders.csv' })">
        Export all CSV
      </ZButton>
      <ZButton
        slot="toolbar"
        size="sm"
        variant="outline"
        tone="neutral"
        :disabled="!selected.length"
        @click="tableRef?.$el.exportCsv({ fileName: 'selected-orders.csv', onlySelected: true })"
      >
        Export selected ({{ selected.length }})
      </ZButton>
    </ZDataTable>
    <p role="status">{{ status }}</p>
  </ZStack>
</template>

```

### Case: column-management

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZDataTable, ZStack } from '@zelviora/vue';
import { makeOrders, managedColumns } from '../data.ts';

type TableEl = HTMLElement & {
  getState(): Promise<Record<string, unknown>>;
  setState(state: Record<string, unknown>): Promise<void>;
};

const rows = makeOrders(24);
const tableRef = ref<{ $el: TableEl } | null>(null);
const savedState = ref<Record<string, unknown> | null>(null);
const message = ref('Drag a column header, open its menu, or filter by City / Status / Paid.');

async function saveLayout() {
  const state = await tableRef.value?.$el.getState();
  if (state) {
    savedState.value = state;
    message.value = 'Saved column order, pins, widths, sort and filters.';
  }
}

async function restoreLayout() {
  if (!savedState.value) return;
  await tableRef.value?.$el.setState(savedState.value);
  message.value = 'Restored saved table state.';
}

async function resetLayout() {
  await tableRef.value?.$el.setState({
    sort: [],
    filters: {},
    globalFilter: '',
    hiddenColumns: [],
    columnWidths: {},
    columnOrder: [],
    pinnedColumns: {},
    page: 1,
  });
  message.value = 'Reset layout to defaults.';
}

function onOrderChange(e: CustomEvent<{ columnOrder: string[] }>) {
  message.value = `Column order: ${e.detail.columnOrder.join(' → ')}`;
}

function onPinChange(e: CustomEvent<{ column: string; pinned: string | null }>) {
  message.value = `Column ${e.detail.column} pin: ${e.detail.pinned ?? 'unpinned'}`;
}
</script>

<template>
  <!-- Drag headers or press Alt+Arrow to reorder columns, use header menus to pin/autosize/hide, and persist state. -->
  <ZStack gap="sm">
    <ZStack orientation="horizontal" gap="sm" align-items="center">
      <ZButton size="sm" variant="outline" tone="neutral" @click="saveLayout">Save state</ZButton>
      <ZButton size="sm" variant="outline" tone="neutral" :disabled="!savedState" @click="restoreLayout">Restore state</ZButton>
      <ZButton size="sm" variant="outline" tone="neutral" @click="resetLayout">Reset</ZButton>
    </ZStack>
    <ZDataTable
      ref="tableRef"
      label="Managed order columns"
      row-header="code"
      reorderable-columns
      column-menu
      column-toggle
      searchable
      :page-size="8"
      :columns="managedColumns"
      :rows="rows"
      @z-column-order-change="onOrderChange"
      @z-column-pin-change="onPinChange"
    />
    <p role="status">{{ message }}</p>
  </ZStack>
</template>

```

### Case: conditional

#### Vue
```vue
<script setup lang="ts">
import { ZDataTable } from '@zelviora/vue';
import { basicColumns, makeOrders, type Order } from '../data.ts';

const rows = makeOrders(12);
const rowParts = (r: Order) => (r.status === 'Overdue' ? ['overdue'] : []);
const cellParts = (r: Order, key: string) => (key === 'total' && r.total < 0 ? ['negative'] : []);
</script>

<template>
  <ZDataTable class="demo-data-table-orders" label="Orders" row-header="code" :columns="basicColumns" :rows="rows" :row-parts="rowParts" :cell-parts="cellParts" />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref, watchEffect } from 'vue';
import { ZDataTable } from '@zelviora/vue';
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));
}

const sort = ref<Sort>([]);
const search = ref('');
const page = ref(1);
const data = ref<{ rows: Order[]; total: number }>({ rows: [], total: 0 });
const loading = ref(true);

function setSort(e: CustomEvent<{ sort: Sort }>) { sort.value = e.detail.sort; }
function setSearch(e: CustomEvent<{ query: string }>) { search.value = e.detail.query; }
function setPage(e: CustomEvent<{ page: number }>) { page.value = e.detail.page; }

watchEffect((onCleanup) => {
  let live = true;
  onCleanup(() => { live = false; });
  loading.value = true;
  void query(sort.value, search.value, page.value, 10).then((d) => { if (live) { data.value = d; loading.value = false; } });
});
</script>

<template>
  <ZDataTable label="Orders (server)" row-header="code" processing="manual" searchable :page-size="10" :page-size-options="[10]"
    :columns="basicColumns" :rows="data.rows" :row-count="data.total" :loading="loading" :sort="sort" :page="page" :global-filter="search"
    @z-sort-change="setSort"
    @z-search="setSearch"
    @z-page-change="setPage" />
</template>

```

### Case: editable

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZDataTable, ZStack } from '@zelviora/vue';
import { editableColumns, editError, makeOrders } from '../data.ts';

type Change = { rowKey: string; column: string; value: unknown };

const rows = ref(makeOrders(8));
const message = ref('Edit the customer, the status or the total.');

// The table never changes `rows`: refuse invalid values before, apply the others after.
function check(e: CustomEvent<Change>) {
  const error = editError(e.detail.column, e.detail.value);
  if (error) {
    e.preventDefault();
    message.value = error;
  }
}

function apply(e: CustomEvent<Change>) {
  const { rowKey, column, value } = e.detail;
  rows.value = rows.value.map((r) => (r.key === rowKey ? { ...r, [column]: value } : r));
  message.value = `Saved ${column} of ${rowKey}.`;
}
</script>

<template>
  <!-- Enter or F2 edits a cell, Enter or Tab commits, Escape cancels. -->
  <ZStack gap="sm">
    <ZDataTable label="Editable orders" row-header="code" :page-size="0" :columns="editableColumns" :rows="rows"
      @z-before-cell-change="check" @z-cell-change="apply" />
    <p role="status">{{ message }}</p>
  </ZStack>
</template>

```

### Case: editing-modes

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZDataTable, ZStack } from '@zelviora/vue';
import { advancedEditColumns, editError, makeOrders, type Order } from '../data.ts';

type EditMode = 'cell' | 'row' | 'popup';
type TableEl = HTMLElement & { undo(): Promise<boolean>; redo(): Promise<boolean> };
type ChangeDetail = { rowKey: string; column: string; value: unknown; updatedRow?: Order; changes?: Record<string, unknown> };

const tableRef = ref<{ $el: TableEl } | null>(null);
const rows = ref<Order[]>(makeOrders(6));
const mode = ref<EditMode>('cell');
const message = ref('Double-click or type on a cell to edit; press Delete to clear.');

function check(e: CustomEvent<ChangeDetail>) {
  const err = editError(e.detail.column, e.detail.value);
  if (err) {
    e.preventDefault();
    message.value = err;
  }
}

function apply(e: CustomEvent<ChangeDetail>) {
  const { rowKey, column, value, updatedRow, changes } = e.detail;
  rows.value = rows.value.map((r) => (r.key === rowKey ? (updatedRow ?? { ...r, [column]: value }) : r));
  message.value = `Committed ${changes ? 'row changes' : column} on ${rowKey}.`;
}
</script>

<template>
  <!-- Double-click or type to edit with text (valueSetter), select, checkbox, date and number editors; Undo/Redo history. -->
  <ZStack gap="sm">
    <ZStack orientation="horizontal" gap="sm" align-items="center">
      <ZButton size="sm" :variant="mode === 'cell' ? 'solid' : 'outline'" tone="neutral" @click="mode = 'cell'">Cell mode</ZButton>
      <ZButton size="sm" :variant="mode === 'row' ? 'solid' : 'outline'" tone="neutral" @click="mode = 'row'">Full-row mode</ZButton>
      <ZButton size="sm" :variant="mode === 'popup' ? 'solid' : 'outline'" tone="neutral" @click="mode = 'popup'">Popup mode</ZButton>
      <ZButton size="sm" variant="outline" tone="neutral" @click="tableRef?.$el.undo()">Undo</ZButton>
      <ZButton size="sm" variant="outline" tone="neutral" @click="tableRef?.$el.redo()">Redo</ZButton>
    </ZStack>
    <ZDataTable
      ref="tableRef"
      label="Advanced editable orders"
      row-header="code"
      :edit-mode="mode"
      edit-on-key-press
      cell-flash
      :page-size="0"
      :columns="advancedEditColumns"
      :rows="rows"
      @z-before-cell-change="check"
      @z-cell-change="apply"
    />
    <p role="status">{{ message }}</p>
  </ZStack>
</template>

```

### Case: editors

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZDataTable, ZStack } from '@zelviora/vue';
import { editorColumns, makeEditorRows } from '../data-analytics.ts';

const rows = ref(makeEditorRows());
const message = ref('Double-click a cell to edit it with its own editor.');

function onCellChange(e: CustomEvent<{ rowKey: string; column: string; value: unknown }>) {
  const { rowKey, column, value } = e.detail;
  rows.value = rows.value.map((r) => (r.key === rowKey ? { ...r, [column]: value } : r));
  message.value = `Saved ${column} of ${rowKey}: ${JSON.stringify(value)}`;
}
</script>

<template>
  <!-- One editor per column: text, email, textarea, number, slider, rating, select, radio, combobox, multiselect, tags, date, time, color, checkbox, switch. -->
  <ZStack gap="sm">
    <ZDataTable label="Cell editors" row-header="name" :page-size="0" :columns="editorColumns" :rows="rows" @z-cell-change="onCellChange" />
    <p role="status">{{ message }}</p>
  </ZStack>
</template>

```

### Case: error

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZAlert, ZButton, ZDataTable } from '@zelviora/vue';
import { basicColumns, makeOrders } from '../data.ts';

const rows = ref<ReturnType<typeof makeOrders>>([]);
</script>

<template>
  <ZDataTable label="Orders" row-header="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" @click="rows = makeOrders(5)">Retry</ZButton>
    </ZAlert>
  </ZDataTable>
</template>

```

### Case: expandable

#### Vue
```vue
<script setup lang="ts">
import { ZDataTable, ZTable } from '@zelviora/vue';
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' } },
];
</script>

<template>
  <ZDataTable label="Orders with lines" row-header="code" :columns="basicColumns" :rows="rows" :expanded-keys="['o1']">
    <ZTable v-for="o in rows" :key="o.key" :slot="`expanded:${o.key}`" :caption="`Lines of ${o.code}`" size="sm" :columns="lineColumns" :rows="o.lines" />
  </ZDataTable>
</template>

```

### Case: formula-columns

#### Vue
```vue
<script setup lang="ts">
import { computed, ref } from 'vue';
import { ZButton, ZDataTable, ZStack } from '@zelviora/vue';
import { invoiceColumns, makeInvoiceLines } from '../data-analytics.ts';

type TableEl = HTMLElement & { getComputedRows(): Promise<Array<Record<string, unknown>>> };

const rows = ref(makeInvoiceLines());
const tableRef = ref<{ $el: TableEl } | null>(null);
const zero = ref(false);
const message = ref('Edit Qty, Price or Discount: Amount, Net, Tax, Total and Net per unit follow. Qty 0 gives #DIV/0!.');

function onCellChange(e: CustomEvent<{ rowKey: string; column: string; value: unknown }>) {
  const { rowKey, column, value } = e.detail;
  rows.value = rows.value.map((r) => (r.key === rowKey ? { ...r, [column]: value } : r));
  message.value = `Saved ${column} of ${rowKey}.`;
}

async function showComputed() {
  const computed = await tableRef.value?.$el.getComputedRows();
  const grand = (computed ?? []).reduce((sum, r) => sum + (Number(r.total) || 0), 0);
  message.value = `getComputedRows(): ${computed?.length ?? 0} rows, sum of Total ${grand.toFixed(2)}.`;
}
const errors = computed(() => (zero.value ? 'zero' : 'error'));
</script>

<template>
  <!-- Same-row and horizontal formulas; formulaErrors error shows #DIV/0!, zero shows 0. -->
  <ZStack gap="sm">
    <ZStack orientation="horizontal" gap="sm" align-items="center">
      <ZButton size="sm" variant="outline" tone="neutral" @click="zero = !zero">formulaErrors: {{ errors }}</ZButton>
      <ZButton size="sm" variant="outline" tone="neutral" @click="showComputed">getComputedRows()</ZButton>
    </ZStack>
    <ZDataTable ref="tableRef" label="Invoice lines" row-header="item" :page-size="0"
      :formula-errors="errors" :columns="invoiceColumns" :rows="rows" @z-cell-change="onCellChange" />
    <p role="status">{{ message }}</p>
  </ZStack>
</template>

```

### Case: formula-quarterly

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZDataTable, ZStack } from '@zelviora/vue';
import { makeQuarterly, quarterlyColumns } from '../data-analytics.ts';

const rows = ref(makeQuarterly());
const message = ref('Search a product: "% of all" keeps its value, "% of shown" is recomputed over the visible rows.');

function onCellChange(e: CustomEvent<{ rowKey: string; column: string; value: unknown }>) {
  const { rowKey, column, value } = e.detail;
  rows.value = rows.value.map((r) => (r.key === rowKey ? { ...r, [column]: value } : r));
  message.value = `Saved ${column} of ${rowKey}.`;
}
</script>

<template>
  <!-- {{rows.total}} ignores the filters (share of the whole table), {{visible.total}} follows them (share of the shown rows). -->
  <ZStack gap="sm">
    <ZDataTable label="Quarterly sales" row-header="product" searchable :page-size="0" :columns="quarterlyColumns"
      :rows="rows" @z-cell-change="onCellChange" />
    <p role="status">{{ message }}</p>
  </ZStack>
</template>

```

### Case: formula-tree

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZDataTable, ZStack } from '@zelviora/vue';
import { budgetColumns, makeBudget, type BudgetRow } from '../data-analytics.ts';

// Keys of every row with children: the whole tree starts expanded.
function parentKeys(list: BudgetRow[], out: string[] = []): string[] {
  for (const r of list) {
    if (r.children?.length) {
      out.push(r.key);
      parentKeys(r.children, out);
    }
  }
  return out;
}

// Immutable update of a (nested) row: returns copies along the path only.
function setValue(list: BudgetRow[], key: string, column: string, value: unknown): BudgetRow[] {
  return list.map((r) => {
    if (r.key === key) return { ...r, [column]: value };
    if (r.children) return { ...r, children: setValue(r.children, key, column, value) };
    return r;
  });
}

const rows = ref<BudgetRow[]>(makeBudget());
const expanded = ref<string[]>(parentKeys(rows.value));
const message = ref('Edit a leaf (Enter or F2, a number, Enter): groups and the total budget are recomputed.');

function onCellChange(e: CustomEvent<{ rowKey: string; column: string; value: unknown }>) {
  const { rowKey, column, value } = e.detail;
  rows.value = setValue(rows.value, rowKey, column, value);
  message.value = `Saved ${column} of ${rowKey}.`;
}

function onExpandedChange(e: CustomEvent<{ expandedKeys?: string[] }>) {
  expanded.value = e.detail.expandedKeys ?? [];
}

function reset() {
  rows.value = makeBudget();
  expanded.value = parentKeys(rows.value);
  message.value = 'Budget reset.';
}
</script>

<template>
  <!-- Parents = SUM of their children (formulaScope parent); leaves are typed; Variance and Used % use the same row. -->
  <ZStack gap="sm">
    <ZStack orientation="horizontal" gap="sm" align-items="center">
      <ZButton size="sm" variant="outline" tone="neutral" @click="reset">Reset</ZButton>
    </ZStack>
    <ZDataTable label="Budget 2026" row-header="item" children-key="children" :page-size="0" max-height="460px"
      :columns="budgetColumns" :rows="rows" :expanded-keys="expanded" @z-cell-change="onCellChange"
      @z-expanded-change="onExpandedChange" />
    <p role="status">{{ message }}</p>
  </ZStack>
</template>

```

### Case: formula-workbench

#### Vue
```vue
<script setup lang="ts">
import { computed, ref } from 'vue';
import { ZButton, ZDataTable, ZStack } from '@zelviora/vue';
import {
  budgetColumns, invoiceColumns, makeBudget, makeInvoiceLines, makeQuarterly, quarterlyColumns, type BudgetRow,
} from '../data-analytics.ts';

type TableEl = HTMLElement & {
  getFormulas(): Promise<Record<string, { formula: string | null; formulaScope?: string }>>;
  getComputedRows(): Promise<unknown[]>;
};
type Dataset = 'invoice' | 'quarterly' | 'budget';
type AnyRow = Record<string, unknown> & { key: string; children?: AnyRow[] };

const columnsByDataset = { invoice: invoiceColumns, quarterly: quarterlyColumns, budget: budgetColumns };
const fresh = (d: Dataset): AnyRow[] => (d === 'invoice' ? makeInvoiceLines() : d === 'quarterly' ? makeQuarterly() : makeBudget()) as unknown as AnyRow[];
const parentKeys = (list: BudgetRow[], out: string[] = []): string[] => {
  for (const r of list) if (r.children?.length) { out.push(r.key); parentKeys(r.children, out); }
  return out;
};
function setValue(list: AnyRow[], key: string, column: string, value: unknown): AnyRow[] {
  return list.map((r) => {
    if (r.key === key) return { ...r, [column]: value };
    if (r.children) return { ...r, children: setValue(r.children, key, column, value) };
    return r;
  });
}

const tableRef = ref<{ $el: TableEl } | null>(null);
const dataset = ref<Dataset>('invoice');
const rows = ref<AnyRow[]>(fresh('invoice'));
const expanded = ref<string[]>([]);
const zero = ref(false);
const log = ref('Open the column menu of a header and choose Edit formula…');
const formulas = ref('');
const columns = computed(() => columnsByDataset[dataset.value]);
const errors = computed(() => (zero.value ? 'zero' : 'error'));

function choose(d: Dataset) {
  dataset.value = d;
  rows.value = fresh(d);
  expanded.value = d === 'budget' ? parentKeys(rows.value as unknown as BudgetRow[]) : [];
  formulas.value = '';
  log.value = `Dataset ${d}.`;
}

function onCellChange(e: CustomEvent<{ rowKey: string; column: string; value: unknown }>) {
  const { rowKey, column, value } = e.detail;
  rows.value = setValue(rows.value, rowKey, column, value);
}

function onExpandedChange(e: CustomEvent<{ expandedKeys?: string[] }>) {
  expanded.value = e.detail.expandedKeys ?? [];
}

async function onFormulaChange(e: CustomEvent<{ column: string; formula: string | null }>) {
  log.value = `zColumnFormulaChange ${e.detail.column} = ${e.detail.formula ?? '(removed)'}`;
  formulas.value = JSON.stringify(await tableRef.value?.$el.getFormulas());
}

async function showFormulas() {
  formulas.value = JSON.stringify(await tableRef.value?.$el.getFormulas());
}

async function showComputed() {
  const computedRows = await tableRef.value?.$el.getComputedRows();
  log.value = `getComputedRows(): ${computedRows?.length ?? 0} row(s).`;
}
</script>

<template>
  <!-- One table, three datasets; the formula editor changes the formula of any column at runtime. -->
  <ZStack gap="sm">
    <ZStack orientation="horizontal" gap="sm" align-items="center">
      <ZButton size="sm" tone="neutral" :variant="dataset === 'invoice' ? 'solid' : 'outline'" @click="choose('invoice')">Invoice</ZButton>
      <ZButton size="sm" tone="neutral" :variant="dataset === 'quarterly' ? 'solid' : 'outline'" @click="choose('quarterly')">Quarterly</ZButton>
      <ZButton size="sm" tone="neutral" :variant="dataset === 'budget' ? 'solid' : 'outline'" @click="choose('budget')">Budget</ZButton>
      <ZButton size="sm" variant="outline" tone="neutral" @click="zero = !zero">formulaErrors: {{ errors }}</ZButton>
      <ZButton size="sm" variant="outline" tone="neutral" @click="showFormulas">getFormulas()</ZButton>
      <ZButton size="sm" variant="outline" tone="neutral" @click="showComputed">getComputedRows()</ZButton>
    </ZStack>
    <ZDataTable :key="dataset" ref="tableRef" label="Formula workbench" :row-header="dataset === 'quarterly' ? 'product' : 'item'" formula-editor children-key="children"
      :page-size="0" max-height="460px" :formula-errors="errors" :columns="columns" :rows="rows"
      :expanded-keys="dataset === 'budget' ? expanded : undefined" @z-cell-change="onCellChange"
      @z-expanded-change="onExpandedChange" @z-column-formula-change="onFormulaChange" />
    <p role="status">{{ log }}</p>
    <code>{{ formulas || 'getFormulas() is shown on request or after an edit.' }}</code>
  </ZStack>
</template>

```

### Case: grouped

#### Vue
```vue
<script setup lang="ts">
import { ZDataTable } from '@zelviora/vue';
import { groupedColumns, makeOrders } from '../data.ts';

const rows = makeOrders(8);
</script>

<template>
  <ZDataTable label="Orders" row-header="code" selection-mode="multiple" :columns="groupedColumns" :rows="rows" />
</template>

```

### Case: grouping-dragging

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZDataTable, ZStack } from '@zelviora/vue';
import { basicColumns, groupedRowColumns, makeOrders, type Order } from '../data.ts';

const groupedDataset = makeOrders(18);
const groupKeys = ref<string[]>(['city']);
const expanded = ref<string[]>(['group:city=London']);
const queue = ref<Order[]>(makeOrders(5));
const dragMessage = ref('Drag a row handle or press Alt+ArrowUp / Alt+ArrowDown to reorder.');

function onExpandedChange(e: CustomEvent<{ expandedKeys?: string[] }>) {
  expanded.value = e.detail.expandedKeys ?? [];
}

function onRowReorder(e: CustomEvent<{ sourceKey: string; targetKey: string; position: string; rows: unknown[] }>) {
  queue.value = e.detail.rows as Order[];
  dragMessage.value = `Moved ${e.detail.sourceKey} ${e.detail.position} ${e.detail.targetKey}.`;
}
</script>

<template>
  <!-- Client-side groupBy + aggFunc summary rows above, and rowDraggable priority queue below. -->
  <ZStack gap="lg">
    <ZStack gap="sm">
      <ZStack orientation="horizontal" gap="sm" align-items="center">
        <ZButton size="sm" :variant="groupKeys.length === 1 ? 'solid' : 'outline'" tone="neutral" @click="groupKeys = ['city']">
          Group by City
        </ZButton>
        <ZButton size="sm" :variant="groupKeys.length === 2 ? 'solid' : 'outline'" tone="neutral" @click="groupKeys = ['city', 'status']">
          Group by City & Status
        </ZButton>
        <ZButton size="sm" :variant="groupKeys.length === 0 ? 'solid' : 'outline'" tone="neutral" @click="groupKeys = []">
          Ungrouped
        </ZButton>
      </ZStack>
      <ZDataTable
        label="Regional order aggregations"
        row-header="code"
        :page-size="0"
        max-height="300px"
        :group-by="groupKeys"
        :expanded-keys="expanded"
        :columns="groupedRowColumns"
        :rows="groupedDataset"
        @z-expanded-change="onExpandedChange"
      />
    </ZStack>
    <ZStack gap="sm">
      <ZDataTable
        label="Dispatch priority queue"
        row-header="code"
        row-draggable
        :page-size="0"
        :columns="basicColumns"
        :rows="queue"
        @z-row-order-change="onRowReorder"
      />
      <p role="status">{{ dragMessage }}</p>
    </ZStack>
  </ZStack>
</template>

```

### Case: i18n

#### Vue
```vue
<script setup lang="ts">
import { ZConfigProvider, ZDataTable } from '@zelviora/vue';
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.
</script>

<template>
  <ZConfigProvider locale="vi">
    <ZDataTable label="Đơn hàng" row-header="code" selection-mode="multiple" searchable :columns="columns" :rows="rows" />
  </ZConfigProvider>
</template>

```

### Case: lazy-datasource

#### Vue
```vue
<script setup lang="ts">
import { withTableCells, ZBadge, ZDataTable, ZStack } from '@zelviora/vue';
import { basicColumns, createOrderDatasource, datasourceColumns, makeOrders, statusTone, type Order } from '../data.ts';

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

const canExpand = (row: Order) => Array.isArray(row.lines) && row.lines.length > 0;
const formatDetail = (row: Order) => `${row.code} (${row.city}) — ${row.lines.map((l) => `${l.qty}× ${l.product}`).join(', ')}`;
</script>

<template>
  <!-- Top: withTableCells mounts #cell badges only for viewport rows. Bottom: LRU block datasource + lazy renderDetail. -->
  <ZStack gap="lg">
    <DataTableWithCells
      label="Virtualized status badges (500 orders)"
      row-header="code"
      virtual="on"
      max-height="240px"
      :page-size="0"
      :columns="datasourceColumns"
      :rows="virtualSlotRows"
    >
      <template #cell="{ key, value }: { key: string; value: unknown }">
        <ZBadge v-if="key === 'status'" :tone="statusTone(value)">{{ String(value) }}</ZBadge>
      </template>
    </DataTableWithCells>
    <ZDataTable
      label="Server block datasource with lazy detail (400 orders)"
      row-header="code"
      searchable
      max-height="260px"
      :columns="basicColumns"
      :datasource="datasource"
      :row-expandable="canExpand"
      :render-detail="formatDetail"
    />
  </ZStack>
</template>

```

### Case: multi-sort

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZDataTable, ZStack } from '@zelviora/vue';
import { basicColumns, makeOrders } from '../data.ts';

const rows = makeOrders(30);
type Sort = Array<{ key: string; direction: 'ascending' | 'descending' }>;
const sort = ref<Sort>([{ key: 'city', direction: 'ascending' }, { key: 'total', direction: 'descending' }]);

function setSort(e: CustomEvent<{ sort: Sort }>) {
  sort.value = e.detail.sort;
}
</script>

<template>
  <ZStack gap="sm">
    <ZDataTable label="Orders by city, then total" row-header="code" :page-size="10" :columns="basicColumns" :rows="rows" :sort="sort"
      @z-sort-change="setSort" />
    <span>Sort: {{ sort.map((s) => `${s.key} ${s.direction}`).join(', ') || 'none' }}</span>
  </ZStack>
</template>

```

### Case: pinned-rows-spanning

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZDataTable, ZStack } from '@zelviora/vue';
import { makeSpanningRows, makeSummaryRows, orderCellSpan, pinnedTopOrders, spanningColumns } from '../data.ts';

const rows = makeSpanningRows();
const bottomRows = makeSummaryRows(rows);
const failed = ref(false);
</script>

<template>
  <!-- Sticky pinned top/bottom summary rows, wrapped notes, cellSpan, cellPartRules and built-in error state. -->
  <ZStack gap="sm">
    <ZStack orientation="horizontal" gap="sm" align-items="center">
      <ZButton size="sm" variant="outline" tone="neutral" @click="failed = !failed">
        {{ failed ? 'Restore rows' : 'Simulate error state' }}
      </ZButton>
    </ZStack>
    <ZDataTable
      class="demo-data-table-orders"
      label="Shipping manifest with pinned summary rows"
      row-header="code"
      bordered
      max-height="340px"
      :row-height="44"
      :page-size="0"
      :error="failed"
      error-text="Unable to load shipping manifest from warehouse gateway."
      :columns="spanningColumns"
      :rows="failed ? [] : rows"
      :pinned-top-rows="failed ? [] : pinnedTopOrders"
      :pinned-bottom-rows="failed ? [] : bottomRows"
      :cell-span="orderCellSpan"
    />
  </ZStack>
</template>

```

### Case: pinned

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZDataTable, ZStack } from '@zelviora/vue';
import { makeWideRows, wideColumns } from '../data.ts';

const rows = makeWideRows(30);
const last = ref('');

function showWidth(e: CustomEvent<{ column: string; width: number }>) {
  last.value = `${e.detail.column}: ${e.detail.width} px`;
}
</script>

<template>
  <ZStack gap="sm">
    <ZDataTable label="Order metrics" row-header="code" max-height="20rem" :page-size="0" :columns="wideColumns" :rows="rows"
      @z-column-width-change="showWidth" />
    <span>{{ last ? `Last resize: ${last}` : 'Resize a column to see its new width.' }}</span>
  </ZStack>
</template>

```

### Case: pivot-basic

#### Vue
```vue
<script setup lang="ts">
import { makeSales, salesColumns } from '../data-analytics.ts';
import { ZDataTable, ZStack } from '@zelviora/vue';

const rows = makeSales();
// Row dimension region, one generated column per year, summed revenue, a Total column and a grand-total row.
const pivot = {
  rows: ['region'],
  columns: ['year'],
  values: [{ key: 'revenue', aggFunc: 'sum' as const }],
  totalColumn: true,
  totalRow: true,
};
</script>

<template>
  <!-- pivotMode builds the pivot from `rows`; the columns come from the distinct values of `year`. -->
  <ZStack gap="sm">
    <ZDataTable label="Revenue by region and year" row-header="region" pivot-mode :pivot="pivot" :page-size="0"
      :columns="salesColumns" :rows="rows" />
  </ZStack>
</template>

```

### Case: pivot-formula

#### Vue
```vue
<script setup lang="ts">
import { computed, ref } from 'vue';
import { ZButton, ZDataTable, ZStack } from '@zelviora/vue';
import { makeSales, salesFormulaColumns, weightedLineMargin } from '../data-analytics.ts';

type TableEl = HTMLElement & { getFormulas(): Promise<Record<string, { formula: string | null }>> };

const rows = makeSales();
const tableRef = ref<{ $el: TableEl } | null>(null);
const pivotMode = ref(true);
const log = ref('Edit the Profit formula (column menu, Edit formula…): the pivot is recomputed.');
// Profit and margin are formula columns of the source rows; margin is a ratio, so it pivots with weightedLineMargin.
const pivot = {
  rows: ['region'],
  columns: ['year'],
  values: [
    { key: 'profit', aggFunc: 'sum' as const },
    { key: 'margin', aggFunc: weightedLineMargin, header: 'Margin %' },
  ],
  totalColumn: true,
  totalRow: true,
};
const label = computed(() => (pivotMode.value ? 'Show source table' : 'Show pivot'));

async function onFormulaChange(e: CustomEvent<{ column: string; formula: string | null }>) {
  const all = await tableRef.value?.$el.getFormulas();
  log.value = `zColumnFormulaChange ${e.detail.column} = ${e.detail.formula ?? '(removed)'}; formulas: ${Object.keys(all ?? {}).join(', ') || '-'}`;
}

function onPivotChange(e: CustomEvent<{ pivotMode: boolean }>) {
  pivotMode.value = e.detail.pivotMode;
}
</script>

<template>
  <!-- Formulas run on the source rows before the pivot, so the pivot aggregates the computed profit and margin. -->
  <ZStack gap="sm">
    <ZStack orientation="horizontal" gap="sm" align-items="center">
      <ZButton size="sm" variant="outline" tone="neutral" @click="pivotMode = !pivotMode">{{ label }}</ZButton>
    </ZStack>
    <ZDataTable ref="tableRef" label="Profit pivot with formulas" row-header="region" :pivot-mode="pivotMode" :pivot="pivot"
      pivot-sidebar row-group-panel formula-editor :page-size="0" max-height="460px" :columns="salesFormulaColumns"
      :rows="rows" @z-column-formula-change="onFormulaChange" @z-pivot-change="onPivotChange" />
    <p role="status">{{ log }}</p>
  </ZStack>
</template>

```

### Case: pivot-groups

#### Vue
```vue
<script setup lang="ts">
import { computed, ref } from 'vue';
import { ZButton, ZDataTable, ZStack } from '@zelviora/vue';
import { makeSales, salesColumns, weightedMargin } from '../data-analytics.ts';

type TotalColumn = 'before' | 'after' | false;

const rows = makeSales();
const columns = [
  ...salesColumns,
  { key: 'margin', header: 'Margin %', type: 'number' as const },
];
const split = ref(true);
const totalColumn = ref<TotalColumn>('after');
const expandAll = ref(false);
const descending = ref(false);

// Region > product tree with subtotals; margin uses a custom aggFunc (sum(profit) / sum(revenue)).
const pivot = computed(() => ({
  rows: ['region', 'product'],
  columns: ['year'],
  values: [
    { key: 'revenue', aggFunc: 'sum' as const },
    { key: 'units', aggFunc: 'sum' as const },
    { key: 'margin', aggFunc: weightedMargin, header: 'Margin %' },
  ],
  splitValues: split.value,
  totalColumn: totalColumn.value,
  groupDefaultExpanded: expandAll.value ? -1 : 1,
  sortColumns: descending.value ? ('descending' as const) : ('ascending' as const),
}));
const variant = (on: boolean) => (on ? 'solid' : 'outline');
</script>

<template>
  <ZStack gap="sm">
    <ZStack orientation="horizontal" gap="sm" align-items="center">
      <ZButton size="sm" tone="neutral" :variant="variant(split)" @click="split = !split">Split values</ZButton>
      <ZButton size="sm" tone="neutral" :variant="variant(totalColumn === 'before')" @click="totalColumn = 'before'">Total before</ZButton>
      <ZButton size="sm" tone="neutral" :variant="variant(totalColumn === 'after')" @click="totalColumn = 'after'">Total after</ZButton>
      <ZButton size="sm" tone="neutral" :variant="variant(totalColumn === false)" @click="totalColumn = false">No total</ZButton>
      <ZButton size="sm" tone="neutral" :variant="variant(expandAll)" @click="expandAll = !expandAll">Expand all groups</ZButton>
      <ZButton size="sm" tone="neutral" :variant="variant(descending)" @click="descending = !descending">Years descending</ZButton>
    </ZStack>
    <ZDataTable label="Revenue, units and margin by region, product and year" row-header="region" pivot-mode
      :pivot="pivot" :page-size="0" max-height="460px" :columns="columns" :rows="rows" />
  </ZStack>
</template>

```

### Case: pivot-workbench

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZDataTable, ZStack } from '@zelviora/vue';
import { makeSales, salesColumns } from '../data-analytics.ts';

type Pivot = { rows: string[]; columns: string[]; values: Array<{ key: string; aggFunc?: string }>; [k: string]: unknown };
type TableEl = HTMLElement & {
  setPivotConfig(config: Pivot | null): Promise<void>;
  getPivotConfig(): Promise<Pivot | null>;
  exportCsv(opts?: { fileName?: string }): Promise<void>;
};

const rows = makeSales();
const tableRef = ref<{ $el: TableEl } | null>(null);
const pivot = ref<Pivot | null>({
  rows: ['region'],
  columns: ['year'],
  values: [{ key: 'revenue', aggFunc: 'sum' }],
  totalColumn: true,
  totalRow: true,
});
const log = ref('No event yet.');
const config = ref('');

const presets: Record<string, Pivot | null> = {
  'By region x year': { rows: ['region'], columns: ['year'], values: [{ key: 'revenue', aggFunc: 'sum' }], totalColumn: true, totalRow: true },
  'Product x channel': { rows: ['product'], columns: ['channel'], values: [{ key: 'units', aggFunc: 'sum' }, { key: 'revenue', aggFunc: 'avg' }], splitValues: true, totalColumn: 'before' },
  Detail: null,
};

async function refresh() {
  config.value = JSON.stringify(await tableRef.value?.$el.getPivotConfig());
}

async function apply(name: string) {
  await tableRef.value?.$el.setPivotConfig(presets[name] ?? null);
  await refresh();
}

function onPivotChange(e: CustomEvent<{ pivot: Pivot | null; pivotMode: boolean }>) {
  pivot.value = e.detail.pivot;
  log.value = `zPivotChange pivotMode=${e.detail.pivotMode} rows=${e.detail.pivot?.rows.join(',') ?? '-'} columns=${e.detail.pivot?.columns.join(',') ?? '-'}`;
  refresh();
}

function onRowGroupChange(e: CustomEvent<{ groupBy: string[] }>) {
  log.value = `zRowGroupChange groupBy=${e.detail.groupBy.join(',') || '-'}`;
}
</script>

<template>
  <!-- Pivot sidebar (Columns / Pivot tool panels), row group bar, pivot panel, status bar, CSV export and setPivotConfig() presets. -->
  <ZStack gap="sm">
    <ZStack orientation="horizontal" gap="sm" align-items="center">
      <ZButton v-for="name in Object.keys(presets)" :key="name" size="sm" variant="outline" tone="neutral" @click="apply(name)">
        {{ name }}
      </ZButton>
      <ZButton size="sm" variant="outline" tone="neutral" @click="tableRef?.$el.exportCsv({ fileName: 'pivot.csv' })">Export CSV</ZButton>
    </ZStack>
    <ZDataTable ref="tableRef" label="Pivot workbench" row-header="region" pivot-mode pivot-sidebar row-group-panel pivot-panel
      searchable status-bar :pivot="pivot" :page-size="0" max-height="460px" :columns="salesColumns" :rows="rows"
      @z-pivot-change="onPivotChange" @z-row-group-change="onRowGroupChange" />
    <p role="status">{{ log }}</p>
    <code>{{ config || 'getPivotConfig() is shown after the first change.' }}</code>
  </ZStack>
</template>

```

### Case: rtl

#### Vue
```vue
<script setup lang="ts">
import { ZDataTable } from '@zelviora/vue';
import { groupedColumns, makeOrders } from '../data.ts';

const rows = makeOrders(6);
</script>

<template>
  <div dir="rtl">
    <ZDataTable label="Orders" row-header="code" selection-mode="multiple" searchable :columns="groupedColumns" :rows="rows" />
  </div>
</template>

```

### Case: selection

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZDataTable, ZStack } from '@zelviora/vue';
import { basicColumns, makeOrders } from '../data.ts';

const rows = makeOrders(10);
const selected = ref<string[]>([]);
const sent = ref('');

function setSelected(e: CustomEvent<{ value: string[] }>) {
  selected.value = e.detail.value;
}

function invoice() {
  sent.value = rows.filter((r) => selected.value.includes(r.key)).map((r) => r.code).join(', ');
}
</script>

<template>
  <!-- Locked orders cannot be selected; Space toggles a row, Shift+Arrow extends, Ctrl/Cmd+A selects all. -->
  <ZStack gap="sm">
    <ZDataTable label="Orders to invoice" row-header="code" selection-mode="multiple" disabled-key="locked" :columns="basicColumns" :rows="rows"
      :selected-keys="selected" @z-selection-change="setSelected" />
    <ZStack orientation="horizontal" gap="sm" align-items="center">
      <ZButton :disabled="!selected.length" @click="invoice">Invoice {{ selected.length }} orders</ZButton>
      <span>{{ sent ? `Sent: ${sent}` : 'Locked orders (every ninth) cannot be selected.' }}</span>
    </ZStack>
  </ZStack>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZDataTable, ZStack } from '@zelviora/vue';
import { basicColumns, makeOrders } from '../data.ts';

const rows = makeOrders(5);
const loading = ref(false);
</script>

<template>
  <ZStack gap="lg">
    <ZDataTable label="Loading without rows" loading row-header="code" :columns="basicColumns" :rows="[]" />
    <ZDataTable label="Empty" empty-text="No orders yet" row-header="code" :columns="basicColumns" :rows="[]" />
    <ZStack gap="sm" align-items="start">
      <ZButton variant="outline" tone="neutral" @click="loading = !loading">{{ loading ? 'Stop loading' : 'Reload' }}</ZButton>
      <ZDataTable label="Reloading keeps the rows" :loading="loading" row-header="code" :columns="basicColumns" :rows="rows" />
    </ZStack>
    <ZDataTable label="Sorted with a selection" selection-mode="multiple" :selected-keys="['o2', 'o4']" :sort="[{ key: 'customer', direction: 'ascending' }]" row-header="code" :columns="basicColumns" :rows="rows" />
  </ZStack>
</template>

```

### Case: toolbar

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZDataTable } from '@zelviora/vue';
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 []; } };
const hidden = ref<string[]>(load());

function save(e: CustomEvent<{ hiddenColumns: string[] }>) {
  hidden.value = e.detail.hiddenColumns;
  try { localStorage.setItem(STORE, JSON.stringify(hidden.value)); } catch { /* private mode */ }
}
</script>

<template>
  <!-- Type "lon" to find "London"; use the funnel buttons in the headers to filter a column. -->
  <ZDataTable label="Orders" row-header="code" searchable column-toggle column-menu :page-size="10" :columns="orderColumns" :rows="rows"
    :hidden-columns="hidden" @z-column-visibility-change="save">
    <ZButton slot="toolbar" size="sm" variant="outline" tone="neutral">Export</ZButton>
  </ZDataTable>
</template>

```

### Case: transactions

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZDataTable, ZStack } from '@zelviora/vue';
import { makeOrders, transactionColumns, type Order } from '../data.ts';

type TableEl = HTMLElement & {
  rows: Order[];
  applyTransaction(tx: { add?: Order[]; addIndex?: number; update?: Order[]; remove?: string[] }): Promise<{
    added: Order[];
    updated: Order[];
    removed: Order[];
  }>;
};

let nextOrderSeq = 100;

const tableRef = ref<{ $el: TableEl } | null>(null);
const rows = ref<Order[]>(makeOrders(8));
const status = ref('Click a cell or run a delta transaction.');
const rowKeyFn = (row: Record<string, unknown>) => String(row.code);

async function addOrder() {
  const id = ++nextOrderSeq;
  const sample = makeOrders(1)[0]!;
  const created: Order = { ...sample, key: `o${id}`, code: `DH-${String(id).padStart(4, '0')}`, total: 640 };
  const res = await tableRef.value?.$el.applyTransaction({ add: [created], addIndex: 0 });
  if (res) status.value = `Added ${res.added.length} order (${created.code}) at index 0.`;
}

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

async function removeLast() {
  const current = tableRef.value?.$el.rows ?? [];
  if (!current.length) return;
  const last = current[current.length - 1]!;
  const res = await tableRef.value?.$el.applyTransaction({ remove: [last.code] });
  if (res) status.value = `Removed ${res.removed.length} order (${last.code}).`;
}

function onCellClick(e: CustomEvent<{ rowKey: string; column: string; value: unknown }>) {
  status.value = `Clicked ${e.detail.column} on ${e.detail.rowKey}: ${String(e.detail.value)}`;
}
</script>

<template>
  <!-- Delta transactions add, update and remove rows in place with cell flash while preserving focus and scroll. -->
  <ZStack gap="sm">
    <ZStack orientation="horizontal" gap="sm" align-items="center">
      <ZButton size="sm" @click="addOrder">Add order</ZButton>
      <ZButton size="sm" variant="outline" tone="neutral" @click="bumpFirstTotal">Increase first (+$125)</ZButton>
      <ZButton size="sm" variant="outline" tone="destructive" @click="removeLast">Remove last</ZButton>
    </ZStack>
    <ZDataTable
      ref="tableRef"
      label="Live order stream"
      row-header="code"
      :row-key="rowKeyFn"
      cell-flash
      :page-size="0"
      :columns="transactionColumns"
      :rows="rows"
      @z-cell-click="onCellClick"
    />
    <p role="status">{{ status }}</p>
  </ZStack>
</template>

```

### Case: tree

#### Vue
```vue
<script setup lang="ts">
import { ZDataTable } from '@zelviora/vue';
import { categories } from '../data.ts';

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

<template>
  <ZDataTable label="Catalog" row-header="name" selection-mode="multiple" :expanded-keys="['c1']" :columns="columns" :rows="categories" />
</template>

```

### Case: virtual

#### Vue
```vue
<script setup lang="ts">
import { ZDataTable } from '@zelviora/vue';
import { basicColumns, makeOrders } from '../data.ts';

const rows = makeOrders(10_000);
</script>

<template>
  <ZDataTable label="All orders" row-header="code" selection-mode="multiple" virtual="on" max-height="24rem" :page-size="0" :columns="basicColumns" :rows="rows" />
</template>

```

### Case: wide

#### Vue
```vue
<script setup lang="ts">
import { ZDataTable } from '@zelviora/vue';
import { dailyColumns, makeDailyRows } from '../data.ts';

// 201 columns × 1000 rows: only the cells in view render (rows and columns); End / Ctrl+End scroll to the cell.
const rows = makeDailyRows(1000);
</script>

<template>
  <ZDataTable label="Daily sales" row-header="store" virtual="on" virtual-columns="on" max-height="24rem" :page-size="0" :columns="dailyColumns" :rows="rows" />
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZDatePicker, ZStack } from '@zelviora/vue';

// The app owns `value` (v-model): buttons set it from code (no event), the log lists user changes and month changes.
const value = ref<string | null>('2026-10-15');
const log = ref<string[]>([]);
const add = (line: string) => { log.value = [line, ...log.value].slice(0, 5); };

function onChange(e: CustomEvent<{ value: string | null }>) {
  add(`zChange ${e.detail.value}`);
}
function onMonth(e: CustomEvent<{ month: string }>) {
  add(`zMonthChange ${e.detail.month}`);
}
</script>

<template>
  <ZStack class="demo-narrow">
    <ZDatePicker v-model="value" label="Deadline" today="2026-10-02" @z-change="onChange" @z-month-change="onMonth" />
    <ZStack orientation="horizontal" gap="sm" wrap>
      <ZButton variant="outline" tone="neutral" @click="value = '2026-12-31'">Set Dec 31, 2026</ZButton>
      <ZButton variant="outline" tone="neutral" @click="value = null">Clear</ZButton>
    </ZStack>
    <span>Value: {{ value ?? 'null' }}</span>
    <output>{{ log.join(' · ') }}</output>
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZDatePicker } from '@zelviora/vue';

// Component tokens and calendar parts (`::part(calendar-cell-selected)`): see the `demo-date-picker-brand` rule in README.
</script>

<template>
  <ZDatePicker class="demo-narrow demo-date-picker-brand" label="Appointment date" today="2026-10-02" value="2026-10-15" />
</template>

```

### Case: date-time

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZDatePicker, ZStack } from '@zelviora/vue';

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

<template>
  <ZStack class="demo-narrow">
    <ZDatePicker
      v-model="value"
      label="Appointment"
     
      today="2026-10-02"
      show-time
      :minute-step="15"
      :is-time-unavailable="officeHours"
    />
    <span>Value: {{ value ?? 'null' }}</span>
  </ZStack>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZDatePicker, ZStack } from '@zelviora/vue';

// Type the day, month and year, or open the calendar; "today" is fixed so the demo never changes.
// v-model binds `value` through the model event `zChange`.
const value = ref<string | null>(null);
</script>

<template>
  <ZStack class="demo-narrow">
    <ZDatePicker v-model="value" label="Date of birth" today="2026-10-02" hint="Type month/day/year or press Alt+↓ to open the calendar" clearable />
    <span>Value: {{ value ?? 'null' }}</span>
  </ZStack>
</template>

```

### Case: dialog

#### Vue
```vue
<script setup lang="ts">
import { ZDatePicker } from '@zelviora/vue';

// Modal dialog popup (default on touch screens with popup-mode="auto"): focus stays inside, a Close button.
</script>

<template>
  <ZDatePicker class="demo-narrow" label="Check-in date" today="2026-10-02" popup-mode="dialog" />
</template>

```

### Case: form

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZDatePicker, ZField, ZStack } from '@zelviora/vue';

// Native form: the value is submitted as YYYY-MM-DD (FormData), required inside a field, reset restores defaults.
const sent = ref('');

function submit(e: Event) {
  sent.value = JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]);
}
</script>

<template>
  <form class="demo-narrow" @submit.prevent="submit">
    <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" value="2026-10-15" />
      <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
        <ZButton type="submit">Submit</ZButton>
        <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
      </ZStack>
      <output v-if="sent">{{ sent }}</output>
    </ZStack>
  </form>
</template>

```

### Case: i18n

#### Vue
```vue
<script setup lang="ts">
import { ZDatePicker, ZGrid } from '@zelviora/vue';

// Segment order, names and first day of the week follow the locale; Arabic (RTL) keeps Latin digits.
</script>

<template>
  <ZGrid columns="1 sm:2" gap="md">
    <ZDatePicker label="Tiếng Việt (dd/mm/yyyy, thứ Hai)" locale="vi" today="2026-10-02" value="2026-10-15" />
    <ZDatePicker label="English US (mm/dd/yyyy, Sunday)" locale="en-US" today="2026-10-02" value="2026-10-15" />
    <ZDatePicker label="日本語 (yyyy/mm/dd)" locale="ja" today="2026-10-02" value="2026-10-15" />
    <div dir="rtl" lang="ar-EG">
      <ZDatePicker label="العربية" locale="ar-EG" today="2026-10-02" value="2026-10-15" />
    </div>
  </ZGrid>
</template>

```

### Case: month-year

#### Vue
```vue
<script setup lang="ts">
import { ZDatePicker, ZStack } from '@zelviora/vue';

// Month picker (YYYY-MM) and year picker (YYYY): the popup shows months or years.
</script>

<template>
  <ZStack class="demo-narrow">
    <ZDatePicker label="Reporting period" today="2026-10-02" granularity="month" value="2026-10" />
    <ZDatePicker label="Fiscal year" today="2026-10-02" granularity="year" value="2026" />
  </ZStack>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZDatePicker, ZGrid } from '@zelviora/vue';

// Empty, filled, disabled, readonly, invalid and display statuses; a long label in a narrow column wraps.
</script>

<template>
  <ZGrid columns="1 sm:2" gap="md">
    <ZDatePicker label="Empty" today="2026-10-02" />
    <ZDatePicker label="With value" today="2026-10-02" value="2026-10-15" />
    <ZDatePicker label="Disabled" today="2026-10-02" value="2026-10-15" disabled />
    <ZDatePicker label="Readonly" today="2026-10-02" value="2026-10-15" readonly />
    <ZDatePicker label="Invalid" today="2026-10-02" value="2026-10-15" invalid />
    <ZDatePicker label="Warning" today="2026-10-02" value="2026-10-15" status="warning" />
    <ZDatePicker label="Success" today="2026-10-02" value="2026-10-15" status="success" />
    <ZDatePicker
      class="demo-narrow"
      label="Expected date to complete the whole business registration file and submit it to the regulator"
     
      today="2026-10-02"
      value="2026-10-15"
    />
  </ZGrid>
</template>

```

### Case: two-months

#### Vue
```vue
<script setup lang="ts">
import { ZDatePicker } from '@zelviora/vue';

// Two months side by side with ISO week numbers.
</script>

<template>
  <ZDatePicker class="demo-narrow" label="Departure date" today="2026-10-02" value="2026-10-15" :number-of-months="2" :week-numbers="true" />
</template>

```

### Case: unavailable

#### Vue
```vue
<script setup lang="ts">
import { ZDatePicker } from '@zelviora/vue';

// Weekends cannot be picked; typing one gives a custom error. The footer slot adds a note.
// 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;
};
</script>

<template>
  <ZDatePicker class="demo-narrow" label="Working day" today="2026-10-02" :is-date-unavailable="isWeekend">
    <span slot="footer">Monday – Friday only</span>
  </ZDatePicker>
</template>

```

### Case: validation

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZDatePicker, ZStack } from '@zelviora/vue';

// Required, a range (min / max) and a date that does not exist (type 02/31/2026 then leave the field).
</script>

<template>
  <form class="demo-narrow" @submit.prevent>
    <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" value="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>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZDatePicker, ZGrid } from '@zelviora/vue';

// Outline and filled field in every size.
</script>

<template>
  <ZGrid columns="1 sm:3" gap="md">
    <ZDatePicker label="Small" size="sm" today="2026-10-02" value="2026-10-15" />
    <ZDatePicker label="Medium" size="md" today="2026-10-02" value="2026-10-15" />
    <ZDatePicker label="Large" size="lg" today="2026-10-02" value="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>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZDateRangePicker, ZStack } from '@zelviora/vue';

// The app owns `value` (v-model): buttons set it from code (no event); a half-picked range is not a change.
type DateRange = [string | null, string | null];
const value = ref<DateRange>(['2026-10-05', '2026-10-09']);
const log = ref<string[]>([]);
const add = (line: string) => { log.value = [line, ...log.value].slice(0, 5); };

function onChange(e: CustomEvent<{ value: DateRange }>) {
  add(`zChange ${JSON.stringify(e.detail.value)}`);
}
function onMonth(e: CustomEvent<{ month: string }>) {
  add(`zMonthChange ${e.detail.month}`);
}
</script>

<template>
  <ZStack>
    <ZDateRangePicker v-model="value" label="Reporting period" today="2026-10-02" @z-change="onChange" @z-month-change="onMonth" />
    <ZStack orientation="horizontal" gap="sm" wrap>
      <ZButton variant="outline" tone="neutral" @click="value = ['2026-11-01', '2026-11-30']">Set November</ZButton>
      <ZButton variant="outline" tone="neutral" @click="value = [null, null]">Clear</ZButton>
    </ZStack>
    <span>Value: {{ JSON.stringify(value) }}</span>
    <output>{{ log.join(' · ') }}</output>
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZDateRangePicker } from '@zelviora/vue';

// Component tokens and range parts (`::part(calendar-cell-in-range)`): see the `demo-date-range-picker-brand` rule in README.
</script>

<template>
  <ZDateRangePicker class="demo-date-range-picker-brand" label="Time off" today="2026-10-02" start="2026-10-05" end="2026-10-09" />
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZDateRangePicker, ZStack } from '@zelviora/vue';

// Type both dates, or open the calendar and click a start and an end day; "today" is fixed so the demo never changes.
// v-model binds `value` (`[start, end]`) through the model event `zChange`.
const value = ref<[string | null, string | null]>([null, null]);
</script>

<template>
  <ZStack>
    <ZDateRangePicker v-model="value" label="Time off" today="2026-10-02" hint="Type month/day/year or press Alt+↓ to open the calendar" clearable />
    <span>Value: {{ JSON.stringify(value) }}</span>
  </ZStack>
</template>

```

### Case: form

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZDateRangePicker, ZField, ZStack } from '@zelviora/vue';

// Native form: two FormData entries with the same name (start, end); required inside a field; reset restores defaults.
const sent = ref('');

function submit(e: Event) {
  sent.value = JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]);
}
</script>

<template>
  <form @submit.prevent="submit">
    <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 align-items="center" gap="sm">
        <ZButton type="submit">Submit</ZButton>
        <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
      </ZStack>
      <output v-if="sent">{{ sent }}</output>
    </ZStack>
  </form>
</template>

```

### Case: i18n

#### Vue
```vue
<script setup lang="ts">
import { ZDateRangePicker, ZGrid } from '@zelviora/vue';

// Segment order, names and first day of the week follow the locale; Arabic (RTL) mirrors the fields and the calendar.
</script>

<template>
  <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>
</template>

```

### Case: max-days

#### Vue
```vue
<script setup lang="ts">
import { ZDateRangePicker } from '@zelviora/vue';

// A stay of 2 to 30 days: after the first click, days that would make the range too short or too long are disabled.
</script>

<template>
  <ZDateRangePicker label="Room booking" today="2026-10-02" min="2026-10-02" :min-days="2" :max-days="30" hint="Minimum 2 days, maximum 30 days" />
</template>

```

### Case: one-month

#### Vue
```vue
<script setup lang="ts">
import { ZDateRangePicker } from '@zelviora/vue';

// One month at a time in a modal dialog, as on a narrow touch screen.
</script>

<template>
  <ZDateRangePicker class="demo-narrow" label="Business trips" today="2026-10-02" :number-of-months="1" popup-mode="dialog" />
</template>

```

### Case: presets

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZDateRangePicker, ZStack } from '@zelviora/vue';

// Quick ranges in the presets slot set `value` (today is fixed at 2026-10-02).
const value = ref<[string | null, string | null]>([null, null]);
</script>

<template>
  <ZStack>
    <ZDateRangePicker v-model="value" label="Date range" today="2026-10-02">
      <ZStack slot="presets" gap="xs">
        <ZButton size="sm" variant="ghost" tone="neutral" @click="value = ['2026-09-26', '2026-10-02']">Last 7 days</ZButton>
        <ZButton size="sm" variant="ghost" tone="neutral" @click="value = ['2026-09-03', '2026-10-02']">Last 30 days</ZButton>
        <ZButton size="sm" variant="ghost" tone="neutral" @click="value = ['2026-10-01', '2026-10-31']">This month</ZButton>
        <ZButton size="sm" variant="ghost" tone="neutral" @click="value = ['2026-09-01', '2026-09-30']">Last month</ZButton>
      </ZStack>
    </ZDateRangePicker>
    <span>Value: {{ JSON.stringify(value) }}</span>
  </ZStack>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZDateRangePicker, ZGrid } from '@zelviora/vue';

// Empty, filled, disabled, readonly, invalid and display statuses; a long label in a narrow column wraps.
</script>

<template>
  <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
      class="demo-narrow"
      label="Expected period to roll out the whole system at all branches in the southern region"
     
      today="2026-10-02"
      start="2026-10-05"
      end="2026-10-09"
    />
  </ZGrid>
</template>

```

### Case: unavailable

#### Vue
```vue
<script setup lang="ts">
import { ZDateRangePicker, ZGrid } from '@zelviora/vue';

// 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);
</script>

<template>
  <ZGrid columns="1 md:2" gap="md">
    <ZDateRangePicker label="Room 101" today="2026-10-02" :is-date-unavailable="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" :is-date-unavailable="isBooked" allow-unavailable-in-range />
  </ZGrid>
</template>

```

### Case: validation

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZDateRangePicker, ZStack } from '@zelviora/vue';

// Required, a min/max range, and an end typed before the start (type 10/10/2026 – 05/10/2026).
</script>

<template>
  <form @submit.prevent>
    <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>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZDateRangePicker, ZGrid } from '@zelviora/vue';

// Outline and filled field in every size.
</script>

<template>
  <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>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZDescriptions, ZDescriptionsItem } from '@zelviora/vue';
</script>

<template>
  <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>
</template>

```

### Case: composition

#### Vue
```vue
<script setup lang="ts">
import { ZBadge, ZButton, ZCard, ZDescriptions, ZDescriptionsItem, ZLink, ZTag } from '@zelviora/vue';
</script>

<template>
  <ZCard>
    <ZDescriptions heading="Project" :heading-level="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>
</template>

```

### Case: data

#### Vue
```vue
<script setup lang="ts">
import { ZDescriptions } from '@zelviora/vue';

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

<template>
  <ZDescriptions heading="Invoice" :items="items" bordered />
</template>

```

### Case: responsive

#### Vue
```vue
<script setup lang="ts">
import { ZDescriptions, ZDescriptionsItem } from '@zelviora/vue';
</script>

<template>
  <ZDescriptions heading="Auto columns" class="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>
</template>

```

### Case: sizes

#### Vue
```vue
<script setup lang="ts">
import { ZDescriptions, ZDescriptionsItem, ZStack } from '@zelviora/vue';

const sizes = ['sm', 'md', 'lg'] as const;
</script>

<template>
  <ZStack gap="lg">
    <ZDescriptions v-for="size in sizes" :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>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZDescriptions, ZDescriptionsItem, ZStack } from '@zelviora/vue';
</script>

<template>
  <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>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZDialog, ZField, ZInput, ZStack, ZTag, ZText } from '@zelviora/vue';

const open = ref(false);
const log = ref<string[]>([]);

function onOpenChange(e: CustomEvent<{ open: boolean; reason: string }>) {
  open.value = e.detail.open;
  log.value.push(`${e.detail.open ? 'opened' : 'closed'} (${e.detail.reason})`);
}
</script>

<template>
  <ZStack gap="sm">
    <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
      <ZButton @click="open = true">Open from state</ZButton>
      <ZTag size="sm">open: {{ open }}</ZTag>
    </ZStack>
    <ZDialog heading="Rename project" :open="open" show-footer confirm-label="Save" @z-open-change="onOpenChange">
      <ZField label="New name">
        <ZInput name="name" autofocus />
      </ZField>
    </ZDialog>
    <ZStack v-if="log.length > 0" gap="xs">
      <ZText v-for="(entry, i) in log" :key="i" size="sm" variant="muted">{{ entry }}</ZText>
    </ZStack>
  </ZStack>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZDialog, ZText } from '@zelviora/vue';
</script>

<template>
  <ZDialog heading="Project details" description="Summary of the current project." show-footer hide-cancel confirm-label="Close">
    <ZButton slot="trigger">Open dialog</ZButton>
    <ZText as="p">The project was created on 2 October 2026 and has 12 members.</ZText>
  </ZDialog>
</template>

```

### Case: non-modal

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZDialog, ZText } from '@zelviora/vue';
</script>

<template>
  <ZDialog heading="Keyboard shortcuts" non-modal 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>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZDonutChart } from '@zelviora/vue-chart';
import { costData, costSeries } from '../data.ts';
</script>

<template>
  <ZDonutChart
    heading="Monthly Cloud Cost Allocation (USD)"
    description="Compute and Database clusters account for the majority of monthly cloud spend."
    x-key="service" :data="costData" :series="costSeries"
  />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/vue';
import {
  ZDonutChart,
  type ChartPointSelectDetail,
  type ChartSeriesToggleDetail,
} from '@zelviora/vue-chart';
import { costData, costSeries } from '../data.ts';

const hidden = ref<string[]>([]);
const selected = ref('Click any chart element to inspect');

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

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

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" gap="sm" align-items="center" wrap>
      <ZButton size="sm" variant="outline" @click="hidden = []">
        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."
      x-key="service" :data="costData" :series="costSeries"
      selectable
      :hidden-series="hidden"
      @z-series-toggle="onToggle"
      @z-point-select="onSelect"
    />
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZDonutChart } from '@zelviora/vue-chart';
import { costData, costSeries } from '../data.ts';
</script>

<template>
  <ZDonutChart
    class="demo-chart-brand"
    description="Compute and Database clusters account for the majority of monthly cloud spend."
    :value-format="{ maximumFractionDigits: 1 }"
    x-key="service" :data="costData" :series="costSeries" inner-radius="55%" :pad-angle="4" :start-angle="90" renderer="canvas"
  >
    <span slot="heading">Monthly Cloud Cost Allocation (USD) — Custom Theme Tokens &amp; Canvas</span>
  </ZDonutChart>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZDonutChart } from '@zelviora/vue-chart';
import { costData, costSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZDonutChart
      heading="Loading State (aria-busy)"
      loading
      x-key="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."
      show-data-table
      x-key="service" :data="costData" :series="costSeries"
    />
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZDonutChart } from '@zelviora/vue-chart';
import { costData, costSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZDonutChart
      heading="Slim Padded Ring"
      description="Slim ring with angular padding vs thicker ring with external labels hidden."
      x-key="service" :data="costData" :series="costSeries" inner-radius="62%" outer-radius="78%" :pad-angle="3"
    />
    <ZDonutChart
      heading="Compact Thick Ring"
      description="Slim ring with angular padding vs thicker ring with external labels hidden."
      x-key="service" :data="costData" :series="costSeries" inner-radius="35%" outer-radius="72%" :show-label="false"
    />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZDrawer, ZStack } from '@zelviora/vue';

// `open` held in a ref and updated from zOpenChange, which reports the reason (no two-way `open`, D-031).
const open = ref(false);
const log = ref<string[]>([]);

function onOpenChange(e: CustomEvent<{ open: boolean; reason: string }>) {
  open.value = e.detail.open;
  log.value.push(`${e.detail.open ? 'opened' : 'closed'} (${e.detail.reason})`);
}
</script>

<template>
  <ZStack gap="sm">
    <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
      <ZButton @click="open = true">Open from state</ZButton>
      <span>open: {{ open }}</span>
    </ZStack>
    <ZDrawer heading="Filters" :open="open" @z-open-change="onOpenChange">
      <p>Status, owner and date filters go here.</p>
      <ZButton slot="footer" variant="outline" tone="neutral" @click="open = false">Cancel</ZButton>
      <ZButton slot="footer" @click="open = false">Apply</ZButton>
    </ZDrawer>
    <ul>
      <li v-for="(entry, i) in log" :key="i">{{ entry }}</li>
    </ul>
  </ZStack>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZDrawer } from '@zelviora/vue';

// A modal drawer from the end edge: page inert, focus returns to the trigger when it closes.
</script>

<template>
  <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>
</template>

```

### Case: form

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZDrawer, ZInput, ZStack } from '@zelviora/vue';

// An edit form in a drawer: Save submits the form; closing is blocked while the form has unsaved changes.
const open = ref(false);
const dirty = ref(false);
const saved = ref('Mark Tran');
const draft = ref(saved.value);

function beforeClose(e: Event) {
  if (dirty.value) e.preventDefault();
}
function onOpenChange(e: CustomEvent<{ open: boolean; reason: string }>) {
  open.value = e.detail.open;
}
function submit(e: Event) {
  saved.value = String(new FormData(e.currentTarget as HTMLFormElement).get('name') ?? '');
  dirty.value = false;
  open.value = false;
}
</script>

<template>
  <ZStack gap="sm">
    <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
      <ZButton @click="open = 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"
      @z-before-close="beforeClose"
      @z-open-change="onOpenChange"
    >
      <form id="drawer-profile" @reset="dirty = false" @submit.prevent="submit">
        <ZInput v-model="draft" name="name" label="Full name" required @z-input="dirty = 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>
</template>

```

### Case: nested

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZDrawer } from '@zelviora/vue';

// A drawer opened inside another one: the parent moves aside (pushed); Escape closes the top one only.
</script>

<template>
  <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>
</template>

```

### Case: placements

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZConfigProvider, ZDrawer, ZStack } from '@zelviora/vue';

// The four logical edges; in RTL `start` is the right edge.
const placements = ['start', 'end', 'top', 'bottom'] as const;
</script>

<template>
  <ZStack orientation="horizontal" wrap gap="sm">
    <ZDrawer v-for="p in placements" :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>
</template>

```

### Case: sizes

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZDrawer, ZStack } from '@zelviora/vue';

// Width steps (height for top/bottom); never wider than the viewport. Long content scrolls in the body.
const sizes = ['sm', 'md', 'lg', 'xl', 'full'] as const;
</script>

<template>
  <ZStack orientation="horizontal" wrap gap="sm">
    <ZDrawer v-for="s in sizes" :key="s" :heading="`Size ${s}`" :size="s">
      <ZButton slot="trigger" variant="outline" tone="neutral">{{ s }}</ZButton>
      <p v-for="i in 30" :key="i">Paragraph {{ i }}: the body scrolls while the header and footer stay.</p>
      <ZButton slot="footer" data-z-dialog-close>Done</ZButton>
    </ZDrawer>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZDropdownMenu, ZMenuItem, ZStack } from '@zelviora/vue';

// Controlled `open` (+ `@z-open-change`), a disabled menu and typeahead ("r" finds "Rename").
const open = ref(false);

function onOpenChange(e: CustomEvent<{ open: boolean }>) {
  open.value = e.detail.open;
}
</script>

<template>
  <ZStack orientation="horizontal" wrap align-items="center" gap="md">
    <ZDropdownMenu :open="open" @z-open-change="onOpenChange">
      <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" @click="open = 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>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZDropdownMenu, ZMenuItem, ZMenuSeparator, ZStack } from '@zelviora/vue';

const last = ref('');

function onSelect(e: CustomEvent<{ value: string }>) {
  last.value = e.detail.value;
}
</script>

<template>
  <ZStack orientation="horizontal" wrap align-items="center" gap="md">
    <ZDropdownMenu @z-select="onSelect">
      <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>
</template>

```

### Case: i18n

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZDropdownMenu, ZMenuItem } from '@zelviora/vue';

// `lang="vi"`: typeahead on Vietnamese labels ("đ" finds "Đổi tên").
</script>

<template>
  <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>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import {
  ZButton, ZDropdownMenu, ZMenuCheckboxItem, ZMenuGroup, ZMenuItem, ZMenuLabel, ZMenuRadioGroup, ZMenuRadioItem, ZMenuSeparator, ZMenuSub, ZStack,
} from '@zelviora/vue';

// Checkbox items and the radio group bind with v-model (model events of z-menu-checkbox-item / z-menu-radio-group).
const grid = ref(true);
const ruler = ref(false);
const density = ref('comfortable');
</script>

<template>
  <ZStack orientation="horizontal" wrap align-items="center" gap="md">
    <ZDropdownMenu>
      <ZButton slot="trigger" variant="outline" tone="neutral">View</ZButton>
      <ZMenuGroup>
        <ZMenuLabel>Show</ZMenuLabel>
        <ZMenuCheckboxItem v-model="grid" keep-open-on-select>Grid</ZMenuCheckboxItem>
        <ZMenuCheckboxItem v-model="ruler" keep-open-on-select>Ruler</ZMenuCheckboxItem>
      </ZMenuGroup>
      <ZMenuSeparator />
      <ZMenuRadioGroup v-model="density">
        <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>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZEcharts } from '@zelviora/vue-chart';
import { universalData, universalSeries } from '../data.ts';
</script>

<template>
  <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" x-key="quarter" :data="universalData" :series="universalSeries"
  />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/vue';
import {
  ZEcharts,
  type ChartPointSelectDetail,
  type ChartSeriesToggleDetail,
} from '@zelviora/vue-chart';
import { universalData, universalSeries } from '../data.ts';

const hidden = ref<string[]>([]);
const selected = ref('Click any chart element to inspect');

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

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

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" gap="sm" align-items="center" wrap>
      <ZButton size="sm" variant="outline" @click="hidden = []">
        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" x-key="quarter" :data="universalData" :series="universalSeries"
      selectable
      :hidden-series="hidden"
      @z-series-toggle="onToggle"
      @z-point-select="onSelect"
    />
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZEcharts } from '@zelviora/vue-chart';
import { universalData, universalSeries } from '../data.ts';
</script>

<template>
  <ZEcharts
    class="demo-chart-brand"
    description="Switch between any of the 25 chart types or pass a full ECharts option configuration."
    :value-format="{ maximumFractionDigits: 1 }"
    type="combo" x-key="quarter" :data="universalData" :series="universalSeries" data-zoom renderer="canvas"
  >
    <span slot="heading">Universal Declarative & Option-Driven Chart — Custom Theme Tokens &amp; Canvas</span>
  </ZEcharts>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZEcharts } from '@zelviora/vue-chart';
import { universalData, universalSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZEcharts
      heading="Loading State (aria-busy)"
      loading
      type="bar" x-key="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."
      show-data-table
      type="bar" x-key="quarter" :data="universalData" :series="universalSeries"
    />
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZEcharts } from '@zelviora/vue-chart';
import { universalData, universalSeries } from '../data.ts';
</script>

<template>
  <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" x-key="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" x-key="quarter" :data="universalData" :series="universalSeries" smooth data-zoom
    />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZEffectScatterChart } from '@zelviora/vue-chart';
import { anomalyData, anomalySeries } from '../data.ts';
</script>

<template>
  <ZEffectScatterChart
    heading="Regional Anomaly Detection Spikes"
    description="Animated ripple markers highlight peak error rates across primary and failover zones."
    x-key="window" :data="anomalyData" :series="anomalySeries"
  />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/vue';
import {
  ZEffectScatterChart,
  type ChartPointSelectDetail,
  type ChartSeriesToggleDetail,
} from '@zelviora/vue-chart';
import { anomalyData, anomalySeries } from '../data.ts';

const hidden = ref<string[]>([]);
const selected = ref('Click any chart element to inspect');

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

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

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" gap="sm" align-items="center" wrap>
      <ZButton size="sm" variant="outline" @click="hidden = []">
        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."
      x-key="window" :data="anomalyData" :series="anomalySeries"
      selectable
      :hidden-series="hidden"
      @z-series-toggle="onToggle"
      @z-point-select="onSelect"
    />
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZEffectScatterChart } from '@zelviora/vue-chart';
import { anomalyData, anomalySeries } from '../data.ts';
</script>

<template>
  <ZEffectScatterChart
    class="demo-chart-brand"
    description="Animated ripple markers highlight peak error rates across primary and failover zones."
    :value-format="{ maximumFractionDigits: 1 }"
    x-key="window" :data="anomalyData" :series="anomalySeries" :ripple-scale="3.5" tooltip-mode="point" renderer="canvas"
  >
    <span slot="heading">Regional Anomaly Detection Spikes — Custom Theme Tokens &amp; Canvas</span>
  </ZEffectScatterChart>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZEffectScatterChart } from '@zelviora/vue-chart';
import { anomalyData, anomalySeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZEffectScatterChart
      heading="Loading State (aria-busy)"
      loading
      x-key="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."
      show-data-table
      x-key="window" :data="anomalyData" :series="anomalySeries"
    />
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZEffectScatterChart } from '@zelviora/vue-chart';
import { anomalyData, anomalySeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZEffectScatterChart
      heading="Continuous Render Ripple"
      description="Continuous ripple animation on render vs hover-triggered emphasis ripple."
      x-key="window" :data="anomalyData" :series="anomalySeries" show-effect-on="render" :ripple-scale="4" :symbol-size="16"
    />
    <ZEffectScatterChart
      heading="Emphasis Hover Ripple"
      description="Continuous ripple animation on render vs hover-triggered emphasis ripple."
      x-key="window" :data="anomalyData" :series="anomalySeries" show-effect-on="emphasis" :ripple-scale="2.5" :symbol-size="12"
    />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZEmptyState } from '@zelviora/vue';
</script>

<template>
  <ZEmptyState />
</template>

```

### Case: custom

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZEmptyState } from '@zelviora/vue';
</script>

<template>
  <ZEmptyState :heading-level="3">
    <svg slot="image" viewBox="0 0 48 48" width="64" height="64" fill="none" stroke="currentColor" stroke-width="2">
      <rect x="8" y="10" width="32" height="28" rx="3" />
      <path d="M8 18h32M16 26h16M16 32h10" />
    </svg>
    <span slot="heading">No orders yet</span>
    New orders will appear here.
    <ZButton slot="actions">Create order</ZButton>
    <ZButton slot="actions" variant="ghost" tone="neutral">Import from file</ZButton>
  </ZEmptyState>
</template>

```

### Case: no-results

#### Vue
```vue
<script setup lang="ts">
import { computed, ref } from 'vue';
import { ZButton, ZEmptyState, ZInput, ZStack } from '@zelviora/vue';

const query = ref('abc');
const heading = computed(() => (query.value ? `No results for "${query.value}"` : 'Type to search'));
</script>

<template>
  <ZStack gap="md" class="demo-narrow">
    <ZInput v-model="query" type="search" label="Search orders" />
    <ZEmptyState :heading="heading" :heading-level="3">
      Check the spelling or try another keyword.
      <ZButton slot="actions" variant="outline" tone="neutral" :disabled="!query" @click="query = ''">Clear search</ZButton>
    </ZEmptyState>
  </ZStack>
</template>

```

### Case: sizes

#### Vue
```vue
<script setup lang="ts">
import { ZCard, ZEmptyState, ZGrid } from '@zelviora/vue';

const sizes = ['sm', 'md', 'lg'] as const;
</script>

<template>
  <ZGrid columns="1 md:3" gap="md">
    <ZCard v-for="size in sizes" :key="size">
      <ZEmptyState :size="size" :heading="`Size ${size}`" description="No orders yet." />
    </ZCard>
  </ZGrid>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZField, ZInput } from '@zelviora/vue';
</script>

<template>
  <div class="demo-narrow">
    <ZField label="Email" hint="Use your work email" required>
      <ZInput name="email" type="email" required />
    </ZField>
  </div>
</template>

```

### Case: error

#### Vue
```vue
<script setup lang="ts">
import { computed, ref } from 'vue';
import { ZField, ZInput } from '@zelviora/vue';

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

const name = ref('admin');
const error = computed(() => (taken.includes(name.value.trim().toLowerCase()) ? 'This username is already taken.' : null));
</script>

<template>
  <div class="demo-narrow">
    <ZField label="Username" hint="3 to 20 letters" :error="error">
      <ZInput v-model="name" name="username" />
    </ZField>
  </div>
</template>

```

### Case: horizontal

#### Vue
```vue
<script setup lang="ts">
import { ZField, ZInput, ZStack, ZTextarea } from '@zelviora/vue';
</script>

<template>
  <ZStack>
    <ZField label="Full name" orientation="horizontal" required>
      <ZInput name="name" required />
    </ZField>
    <ZField label="Company" orientation="horizontal" show-optional>
      <ZInput name="company" />
    </ZField>
    <ZField label="About you" orientation="horizontal" hint="A few words for your profile">
      <ZTextarea name="about" :rows="2" />
    </ZField>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZFileUpload, ZStack } from '@zelviora/vue';

// Avatar: one image as a card; zBeforeAdd cancels images over 2 MB (the app shows its own message).
const MAX = 2 * 1024 * 1024;
const message = ref('');

function beforeAdd(e: CustomEvent<{ files: File[] }>) {
  const big = e.detail.files.find((f) => f.size > MAX);
  message.value = big ? `${big.name} is larger than 2 MB` : '';
  if (big) e.preventDefault();
}
</script>

<template>
  <ZStack gap="sm">
    <ZFileUpload label="Avatar" list-type="card" :max-count="1" accept="image/*" @z-before-add="beforeAdd" />
    <span v-if="message" class="demo-text-destructive">{{ message }}</span>
  </ZStack>
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZFileUpload, ZStack } from '@zelviora/vue';

// v-model binds `files` through the model event `zChange` (detail.files); the reason is logged.
/** Shape of a list entry (`ZUploadFile` of the core package). */
interface UploadFile { id: string; name: string; size: number; type: string; status: 'pending' | 'uploading' | 'done' | 'error'; progress: number; error?: string }

const files = ref<UploadFile[]>([]);
const log = ref<string[]>([]);

function onChange(e: CustomEvent<{ files: Array<{ name: string }>; reason: string }>) {
  log.value.push(`${e.detail.reason}: ${e.detail.files.map((f) => f.name).join(', ') || '(empty)'}`);
}
function onError(e: CustomEvent<{ error: { reason: 'reject'; rejections: Array<{ name: string; errors: string[] }> } | { reason: 'upload' } }>) {
  const err = e.detail.error;
  if (err.reason === 'reject') log.value.push(`rejected: ${err.rejections.map((r) => `${r.name} (${r.errors.join(', ')})`).join(', ')}`);
}
</script>

<template>
  <ZStack class="demo-narrow">
    <ZFileUpload v-model="files" label="Documents" multiple :max-count="3" @z-change="onChange" @z-error="onError" />
    <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
      <ZButton variant="outline" tone="neutral" @click="files = []">Clear from state</ZButton>
      <span>{{ files.length }} file(s)</span>
    </ZStack>
    <ul>
      <li v-for="(entry, i) in log" :key="i">{{ entry }}</li>
    </ul>
  </ZStack>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ZFileUpload, ZStack } from '@zelviora/vue';

// One file, chosen with the button (keyboard path) or dropped on the zone; sizes follow the locale.
const tenMb = 10 * 1024 * 1024;
const fiveMb = 5 * 1024 * 1024;
</script>

<template>
  <ZStack class="demo-narrow">
    <ZFileUpload name="attachment" label="Attachment" accept=".pdf,image/*" :max-size="tenMb" hint="Tab to the button, then Enter or Space opens the file picker." />
    <ZFileUpload name="contract" label="Contract" accept=".pdf" :max-size="fiveMb" multiple />
  </ZStack>
</template>

```

### Case: finder

#### Vue
```vue
<script setup lang="ts">
import { ZFileUpload, ZGrid } from '@zelviora/vue';

const tenMb = 10 * 1024 * 1024;

const svgThumb = (bg1: string, bg2: string, label: string) =>
  `data:image/svg+xml;utf8,${encodeURIComponent(
    `<svg xmlns="http://www.w3.org/2000/svg" width="320" height="200" viewBox="0 0 320 200"><defs><linearGradient id="g" x1="0" y1="0" x2="1" y2="1"><stop offset="0%" stop-color="${bg1}"/><stop offset="100%" stop-color="${bg2}"/></linearGradient></defs><rect width="320" height="200" rx="16" fill="url(#g)"/><text x="50%" y="54%" dominant-baseline="middle" text-anchor="middle" fill="#ffffff" font-family="system-ui,sans-serif" font-size="22" font-weight="600">${label}</text></svg>`,
  )}`;

const sharedFinderItems = [
  { id: 'dir-brand', name: 'Brand Assets', type: 'folder' as const, parentId: null, updatedAt: '2026-04-10' },
  { id: 'dir-docs', name: 'Project Docs', type: 'folder' as const, parentId: null, updatedAt: '2026-04-11' },
  {
    id: 'img-hero',
    name: 'hero-banner.png',
    type: 'file' as const,
    size: 428_500,
    mimeType: 'image/png',
    dimensions: '1920 x 1080',
    parentId: null,
    updatedAt: '2026-04-12',
    thumbnail: svgThumb('#2563eb', '#7c3aed', 'Hero Banner'),
  },
  {
    id: 'img-cover',
    name: 'product-cover.webp',
    type: 'file' as const,
    size: 312_800,
    mimeType: 'image/webp',
    dimensions: '1600 x 1200',
    parentId: null,
    updatedAt: '2026-04-14',
    thumbnail: svgThumb('#059669', '#0ea5e9', 'Product Cover'),
  },
  {
    id: 'img-logo',
    name: 'zelviora-mark.png',
    type: 'file' as const,
    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' as const,
    size: 1_245_000,
    mimeType: 'application/pdf',
    parentId: null,
    updatedAt: '2026-04-13',
  },
  {
    id: 'doc-budget',
    name: 'quarterly-report.csv',
    type: 'file' as const,
    size: 84_300,
    mimeType: 'text/csv',
    parentId: null,
    updatedAt: '2026-04-15',
  },
  {
    id: 'arc-release',
    name: 'release-bundle.zip',
    type: 'file' as const,
    size: 3_480_000,
    mimeType: 'application/zip',
    parentId: null,
    updatedAt: '2026-04-16',
  },
];

const imageFinderConfig = {
  heading: 'Select images from Finder',
  items: sharedFinderItems,
  viewMode: 'grid' as const,
  maxFileSize: tenMb,
};

const documentFinderConfig = {
  heading: 'Select documents (.pdf, .csv) from Finder',
  items: sharedFinderItems,
  viewMode: 'list' as const,
  maxFileSize: tenMb,
};
</script>

<template>
  <ZGrid columns="1 md:2" gap="lg">
    <ZFileUpload
      finder
      :finder-config="imageFinderConfig"
      label="Product images (Finder — images only)"
      accept="image/*"
      list-type="picture"
      multiple
      :max-size="tenMb"
      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
      :finder-config="documentFinderConfig"
      label="Attachments (Finder — PDF & CSV only)"
      accept=".pdf,.csv"
      multiple
      :max-size="tenMb"
      hint="Opens Finder in list mode filtered by accept='.pdf,.csv': only PDF and CSV documents are visible."
    />
  </ZGrid>
</template>

```

### Case: form

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZField, ZFileUpload, ZStack } from '@zelviora/vue';

// Native form without uploadRequest: each File is a FormData entry under the name; required in a field; reset.
const sent = ref('');
const twoMb = 2 * 1024 * 1024;

function submit(e: Event) {
  const entries = [...new FormData(e.currentTarget as HTMLFormElement).entries()].map(([k, v]) => [k, typeof v === 'string' ? v : `File(${v.name})`]);
  sent.value = JSON.stringify(entries);
}
</script>

<template>
  <form class="demo-narrow" @submit.prevent="submit">
    <ZStack>
      <ZField label="CV" hint="PDF, up to 2 MB" required>
        <ZFileUpload name="cv" accept=".pdf" :max-size="twoMb" required />
      </ZField>
      <ZFileUpload name="certificates" label="Certificates" multiple />
      <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
        <ZButton type="submit">Submit</ZButton>
        <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
      </ZStack>
      <output v-if="sent">{{ sent }}</output>
    </ZStack>
  </form>
</template>

```

### Case: i18n

#### Vue
```vue
<script setup lang="ts">
import { ZFileUpload, ZStack } from '@zelviora/vue';

// `lang="vi"`: built-in texts and sizes follow the Vietnamese locale.
const fiveMb = 5 * 1024 * 1024;
</script>

<template>
  <ZStack class="demo-narrow">
    <ZFileUpload lang="vi" name="hop-dong" label="Hợp đồng" accept=".pdf" :max-size="fiveMb" multiple />
  </ZStack>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZFileUpload, ZGrid } from '@zelviora/vue';

/** Shape of a list entry (`ZUploadFile` of the core package). */
interface UploadFile { id: string; name: string; size: number; type: string; status: 'pending' | 'uploading' | 'done' | 'error'; progress: number; error?: string }

// Uploading, done, upload error, disabled, read-only, required/invalid and a size rejection (max 1 KB).
const uploading: UploadFile[] = [{ id: 'u1', name: 'video-gioi-thieu.mp4', size: 48_000_000, type: 'video/mp4', status: 'uploading', progress: 0.6 }];
const done: UploadFile[] = [{ id: 'd1', name: 'hop-dong.pdf', size: 1_258_291, type: 'application/pdf', status: 'done', progress: 1 }];
const failed: UploadFile[] = [{ id: 'e1', name: 'bang-luong.xlsx', size: 92_000, type: '', status: 'error', progress: 0, error: 'Server error' }];
</script>

<template>
  <ZGrid columns="1 md:2" gap="lg">
    <ZFileUpload label="Uploading" :default-files="uploading" />
    <ZFileUpload label="Done" :default-files="done" />
    <ZFileUpload label="Upload error" :default-files="failed" />
    <ZFileUpload label="Disabled" disabled :default-files="done" />
    <ZFileUpload label="Read-only" readonly :default-files="done" />
    <ZFileUpload label="Invalid" required invalid hint="Required: choose a file." />
    <ZFileUpload label="Max 1 KB" :max-size="1024" hint="Choose a larger file to see the rejection message." />
  </ZGrid>
</template>

```

### Case: upload

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZFileUpload, ZStack } from '@zelviora/vue';

let uploads = 0;

// Simulated upload (no network): progress every 200 ms; every third upload fails so the retry button shows.
const fakeUpload = (file: File, { signal, onProgress }: { signal: AbortSignal; onProgress(p: number): void }) =>
  new Promise<unknown>((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);
    });
  });

// With manual-upload the files wait until upload() is called on the element.
const manual = ref<{ $el: HTMLElement & { upload(id?: string): Promise<void> } } | null>(null);
</script>

<template>
  <ZStack class="demo-narrow" gap="lg">
    <ZFileUpload label="Upload function" multiple :upload-request="fakeUpload" hint="Every third file fails: use the retry button." />
    <ZStack gap="sm">
      <ZFileUpload ref="manual" label="Manual upload" multiple manual-upload :upload-request="fakeUpload" />
      <ZButton @click="manual?.$el.upload()">Upload all</ZButton>
    </ZStack>
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZFileUpload, ZGrid } from '@zelviora/vue';

/** Shape of a list entry (`ZUploadFile` of the core package). */
interface UploadFile { id: string; name: string; size: number; type: string; status: 'pending' | 'uploading' | 'done' | 'error'; progress: number; error?: string }

// Files already on the server (no `file`): shown, not submitted again.
const existing: UploadFile[] = [
  { 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 },
];
</script>

<template>
  <ZGrid columns="1 md:2" gap="lg">
    <ZFileUpload label="Text (default)" multiple :default-files="existing" />
    <ZFileUpload label="Picture" list-type="picture" accept="image/*" multiple :default-files="existing" />
    <ZFileUpload label="Card" list-type="card" accept="image/*" multiple :max-count="4" :default-files="existing" />
    <ZFileUpload label="Button only" hide-dropzone multiple :default-files="existing" />
  </ZGrid>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZFinder, ZStack, ZTag, ZText, type ZFinderItem } from '@zelviora/vue';

const initialItems = ref<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',
  },
]);

const confirmed = ref<ZFinderItem[]>([]);

function onSelect(e: CustomEvent<{ items: ZFinderItem[] }>) {
  confirmed.value = e.detail.items;
}
</script>

<template>
  <ZStack gap="md">
    <ZFinder
      class="demo-finder-frame"
      heading="Media Library"
      :items="initialItems"
      multiple
      @z-select="onSelect"
    />
    <ZStack v-if="confirmed.length > 0" orientation="horizontal" align-items="center" gap="sm" wrap>
      <ZText size="sm" variant="muted">Confirmed:</ZText>
      <ZTag v-for="item in confirmed" :key="item.id">{{ item.name }}</ZTag>
    </ZStack>
  </ZStack>
</template>

```

### Case: config

#### Vue
```vue
<script setup lang="ts">
import { ZFinder, ZStack, type ZFinderConfig, type ZFinderItem } from '@zelviora/vue';

let store: ZFinderItem[] = [
  { id: 'cloud-contracts', name: 'Contracts', type: 'folder', parentId: null, updatedAt: '2026-04-01' },
  {
    id: 'cloud-msa',
    name: 'master-service-agreement.pdf',
    type: 'file',
    size: 940_000,
    mimeType: 'application/pdf',
    parentId: 'cloud-contracts',
    updatedAt: '2026-04-04',
  },
  {
    id: 'cloud-banner',
    name: 'partner-spotlight.png',
    type: 'file',
    size: 1_120_000,
    mimeType: 'image/png',
    dimensions: '1440 x 900',
    parentId: null,
    updatedAt: '2026-04-14',
  },
];

const config: ZFinderConfig = {
  defaultViewMode: 'list',
  maxFileSize: 5 * 1024 * 1024,
  allowedTypes: ['image/*', '.pdf', '.csv'],
  list: async (folderId) => store.filter((entry) => (entry.parentId ?? null) === (folderId ?? null)),
  createFolder: async (name, parentId) => {
    const folder: ZFinderItem = {
      id: `folder-${Date.now()}`,
      name,
      type: 'folder',
      parentId,
      updatedAt: new Date().toISOString(),
    };
    store = [...store, folder];
    return folder;
  },
  upload: async (file, folderId) => {
    const uploaded: ZFinderItem = {
      id: `file-${Date.now()}-${file.name}`,
      name: file.name,
      type: 'file',
      size: file.size,
      mimeType: file.type || 'application/octet-stream',
      parentId: folderId,
      updatedAt: new Date().toISOString(),
    };
    store = [...store, uploaded];
    return uploaded;
  },
  update: async (id, patch) => {
    let updatedEntry: ZFinderItem | undefined;
    store = store.map((entry) => {
      if (entry.id !== id) return entry;
      updatedEntry = { ...entry, ...patch, updatedAt: new Date().toISOString() };
      return updatedEntry;
    });
    return updatedEntry!;
  },
  delete: async (id) => {
    store = store.filter((entry) => entry.id !== id && entry.parentId !== id);
  },
};
</script>

<template>
  <ZStack>
    <ZFinder class="demo-finder-frame" heading="Cloud Storage" :config="config" multiple />
  </ZStack>
</template>

```

### Case: dialog

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZFinder, ZStack, ZTag, ZText, dialogService, type ZFinderItem } from '@zelviora/vue';

const pickerItems = ref<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',
  },
]);

const open = ref(false);
const picked = ref<ZFinderItem[]>([]);

async function openViaService() {
  const dialogRef = dialogService.openFinder({
    heading: 'Select Assets',
    multiple: true,
    items: pickerItems.value,
  });
  const result = await dialogRef.afterClosed;
  if (result) {
    picked.value = result.items;
  }
}

function onSelect(e: CustomEvent<{ items: ZFinderItem[] }>) {
  picked.value = e.detail.items;
}
</script>

<template>
  <ZStack gap="sm" align-items="start">
    <ZStack orientation="horizontal" gap="xs" wrap="wrap">
      <ZButton variant="solid" @click="openViaService">Browse via DialogService</ZButton>
      <ZButton variant="outline" tone="neutral" @click="open = true">Browse Declarative Modal</ZButton>
    </ZStack>

    <ZFinder
      v-model:open="open"
      display-mode="dialog"
      heading="Select Assets"
      multiple
      :items="pickerItems"
      @z-select="onSelect"
    />

    <ZStack v-if="picked.length > 0" orientation="horizontal" align-items="center" gap="xs" wrap="wrap">
      <ZText size="sm" variant="muted">Selected:</ZText>
      <ZTag v-for="item in picked" :key="item.id">{{ item.name }}</ZTag>
    </ZStack>
    <ZText v-else size="sm" variant="muted">No assets selected yet.</ZText>
  </ZStack>
</template>

```

### Case: i18n

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZFinder, ZStack, type ZFinderItem } from '@zelviora/vue';

const duLieu = ref<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',
  },
]);
</script>

<template>
  <ZStack>
    <ZFinder class="demo-finder-frame" lang="vi" :items="duLieu" multiple />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZFloatButton, ZIcon } from '@zelviora/vue';
</script>

<template>
  <div class="demo-fixed-frame">
    <ZFloatButton label="New message"><ZIcon slot="icon" name="mail" /></ZFloatButton>
  </div>
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZFloatButton, ZFloatButtonGroup, ZIcon, ZStack, ZText } from '@zelviora/vue';

const open = ref(false);
const reason = ref('none');

function onOpenChange(e: CustomEvent<{ open: boolean; reason: string }>) {
  open.value = e.detail.open;
  reason.value = e.detail.reason;
}
</script>

<template>
  <ZStack gap="md" align-items="start">
    <ZStack orientation="horizontal" gap="sm" align-items="center">
      <ZButton variant="outline" tone="neutral" @click="open = !open">{{ open ? 'Close' : 'Open' }} from code</ZButton>
      <ZText>Last reason: {{ reason }}</ZText>
    </ZStack>
    <div class="demo-fixed-frame">
      <ZFloatButtonGroup label="Quick actions" :open="open" @z-open-change="onOpenChange">
        <ZFloatButton label="Chat"><ZIcon slot="icon" name="chat" /></ZFloatButton>
        <ZFloatButton label="Help" variant="soft"><ZIcon slot="icon" name="help" /></ZFloatButton>
      </ZFloatButtonGroup>
    </div>
  </ZStack>
</template>

```

### Case: group

#### Vue
```vue
<script setup lang="ts">
import { ZFloatButton, ZFloatButtonGroup, ZIcon } from '@zelviora/vue';
</script>

<template>
  <div class="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>
</template>

```

### Case: placement

#### Vue
```vue
<script setup lang="ts">
import { ZFloatButton, ZFloatButtonGroup, ZIcon } from '@zelviora/vue';
</script>

<template>
  <div class="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>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZBadge, ZFloatButton, ZIcon } from '@zelviora/vue';
</script>

<template>
  <div class="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>
</template>

```


================================================================================
# COMPONENT: FLOW
================================================================================

## Documentation

# Flow Angular Demos

Demo cases for `<z-flow>` in Angular.


## Examples & Implementation

### Case: basic

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZFlow } from '@zelviora/vue';

const nodes = ref([
  {
    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 = ref([
  {
    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',
  },
]);

function onConnect(e: CustomEvent) {
  const { source, target, sourceHandle, targetHandle } = e.detail;
  edges.value.push({
    id: `edge-${Date.now()}`,
    source,
    target,
    sourceHandle,
    targetHandle,
    type: 'smoothstep',
    variant: 'solid',
  });
}
</script>

<template>
  <div class="demo-flow-canvas">
    <ZFlow
      :nodes="nodes"
      :edges="edges"
      :padding="40"
      @z-connect="onConnect"
    />
  </div>
</template>

```

### Case: interactive

#### Vue
```vue
<script setup lang="ts">
import { ref, computed } from 'vue';
import { ZFlow, ZButton, ZStack, ZText } from '@zelviora/vue';

const zoom = ref(1);
const zoomPercent = computed(() => Math.round(zoom.value * 100));

const nodes = ref([
  {
    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 = ref([
  {
    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',
  },
]);

function zoomOut() {
  zoom.value = Math.max(0.5, Number((zoom.value - 0.1).toFixed(1)));
}

function zoomIn() {
  zoom.value = Math.min(2, Number((zoom.value + 0.1).toFixed(1)));
}

function resetZoom() {
  zoom.value = 1;
}
</script>

<template>
  <ZStack gap="sm">
    <ZStack orientation="horizontal" gap="xs" align-items="center">
      <ZText variant="muted" size="sm">Zoom:</ZText>
      <ZButton size="sm" @click="zoomOut">-</ZButton>
      <span class="demo-flow-zoom-label">{{ zoomPercent }}%</span>
      <ZButton size="sm" @click="zoomIn">+</ZButton>
      <ZButton size="sm" variant="outline" @click="resetZoom">Reset</ZButton>
    </ZStack>

    <div class="demo-flow-canvas-interactive">
      <ZFlow
        :nodes="nodes"
        :edges="edges"
        :zoom="zoom"
        :padding="50"
      />
    </div>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZField, ZForm, ZInput, ZStack, ZTextarea } from '@zelviora/vue';

const sent = ref('');

function onSubmit(e: CustomEvent<{ values: unknown }>) {
  sent.value = JSON.stringify(e.detail.values);
}
</script>

<template>
  <ZForm summary prevent-submit @z-submit="onSubmit">
    <form class="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" :min-length="10" />
        </ZField>
        <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
          <ZButton type="submit">Send</ZButton>
          <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
        </ZStack>
        <output v-if="sent">{{ sent }}</output>
      </ZStack>
    </form>
  </ZForm>
</template>

```

### Case: cross-field

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZField, ZForm, ZInput, ZStack } from '@zelviora/vue';

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.' : '');
}
</script>

<template>
  <ZForm summary prevent-submit>
    <form class="demo-narrow">
      <ZStack>
        <ZField label="Password" required>
          <ZInput name="password" required :min-length="8" @z-change="check" />
        </ZField>
        <ZField label="Confirm password" required>
          <ZInput name="confirm" required @z-input="check" />
        </ZField>
        <ZButton type="submit">Create account</ZButton>
      </ZStack>
    </form>
  </ZForm>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZFunnelChart } from '@zelviora/vue-chart';
import { funnelData, funnelSeries } from '../data.ts';
</script>

<template>
  <ZFunnelChart
    heading="Enterprise Trial Conversion Funnel"
    description="Stage-by-stage progression from landing page visits to signed enterprise contracts."
    x-key="stage" :data="funnelData" :series="funnelSeries"
  />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/vue';
import {
  ZFunnelChart,
  type ChartPointSelectDetail,
  type ChartSeriesToggleDetail,
} from '@zelviora/vue-chart';
import { funnelData, funnelSeries } from '../data.ts';

const hidden = ref<string[]>([]);
const selected = ref('Click any chart element to inspect');

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

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

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" gap="sm" align-items="center" wrap>
      <ZButton size="sm" variant="outline" @click="hidden = []">
        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."
      x-key="stage" :data="funnelData" :series="funnelSeries"
      selectable
      :hidden-series="hidden"
      @z-series-toggle="onToggle"
      @z-point-select="onSelect"
    />
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZFunnelChart } from '@zelviora/vue-chart';
import { funnelData, funnelSeries } from '../data.ts';
</script>

<template>
  <ZFunnelChart
    class="demo-chart-brand"
    description="Stage-by-stage progression from landing page visits to signed enterprise contracts."
    :value-format="{ maximumFractionDigits: 1 }"
    x-key="stage" :data="funnelData" :series="funnelSeries" :funnel-gap="4" renderer="canvas"
  >
    <span slot="heading">Enterprise Trial Conversion Funnel — Custom Theme Tokens &amp; Canvas</span>
  </ZFunnelChart>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZFunnelChart } from '@zelviora/vue-chart';
import { funnelData, funnelSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZFunnelChart
      heading="Loading State (aria-busy)"
      loading
      x-key="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."
      show-data-table
      x-key="stage" :data="funnelData" :series="funnelSeries"
    />
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZFunnelChart } from '@zelviora/vue-chart';
import { funnelData, funnelSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZFunnelChart
      heading="Ascending Pyramid"
      description="Ascending pyramid ordering vs left-aligned conversion funnel."
      x-key="stage" :data="funnelData" :series="funnelSeries" funnel-sort="ascending" :funnel-gap="6"
    />
    <ZFunnelChart
      heading="Left-Aligned Funnel"
      description="Ascending pyramid ordering vs left-aligned conversion funnel."
      x-key="stage" :data="funnelData" :series="funnelSeries" funnel-align="left" :funnel-gap="2"
    />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZCard, ZGallery, ZGalleryItem } from '@zelviora/vue';

// Attachments of a ticket inside a card, three columns.
// 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>`)}`;
</script>

<template>
  <ZCard heading="Attachments" description="3 images" class="demo-narrow">
    <ZGallery label="Attachments" :columns="3">
      <ZGalleryItem :src="pic('#bfdbfe', 'IMG_01')" alt="Screenshot of the error" />
      <ZGalleryItem :src="pic('#bbf7d0', 'IMG_02')" alt="Invoice" />
      <ZGalleryItem :src="pic('#fde68a', 'IMG_03')" alt="Delivery receipt" />
    </ZGallery>
  </ZCard>
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZGallery, ZGalleryItem, ZStack } from '@zelviora/vue';

// The app owns `open` and `index` (v-model binds `index` through `zChange`): the button opens the third image from
// code (no event); the log lists user changes.
// 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}` }));
const open = ref(false);
const index = ref(0);
const log = ref<string[]>([]);
const add = (line: string) => { log.value = [line, ...log.value].slice(0, 5); };

function onOpen(e: CustomEvent<{ open: boolean; reason: string }>) {
  open.value = e.detail.open;
  add(`zOpenChange ${e.detail.open} (${e.detail.reason})`);
}
function onChange(e: CustomEvent<{ index: number; reason: string }>) {
  add(`zChange ${e.detail.index} (${e.detail.reason})`);
}
function openThird() {
  index.value = 2;
  open.value = true;
}
</script>

<template>
  <ZStack>
    <ZGallery v-model="index" label="Controlled" :open="open" @z-open-change="onOpen" @z-change="onChange">
      <ZGalleryItem v-for="p in PHOTOS" :key="p.alt" :src="p.src" :alt="p.alt" />
    </ZGallery>
    <ZStack orientation="horizontal" gap="sm" wrap>
      <ZButton variant="outline" tone="neutral" @click="openThird">Open image 3</ZButton>
    </ZStack>
    <span>open: {{ String(open) }} · index: {{ index }}</span>
    <output>{{ log.join(' · ') }}</output>
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZGallery, ZGalleryItem } from '@zelviora/vue';

// `columns="3"`, gallery tokens (gap, radius) and the lightbox counter part: see `demo-gallery-brand` in README.
// 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}` }));
</script>

<template>
  <ZGallery class="demo-gallery-brand" label="Customization" :columns="3">
    <ZGalleryItem v-for="p in PHOTOS" :key="p.alt" :src="p.src" :alt="p.alt" />
  </ZGallery>
</template>

```

### Case: data

#### Vue
```vue
<script setup lang="ts">
import { ZGallery } from '@zelviora/vue';

// 300 images through `items` + `lazy`: only thumbnails near the viewport are created.
// 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,
}));
</script>

<template>
  <div class="demo-gallery-scroll">
    <ZGallery label="Album of 300 photos" :items="ITEMS" lazy />
  </div>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ZGallery, ZGalleryItem } from '@zelviora/vue';

// Eight thumbnails: each is a button (one Tab stop); Enter opens the lightbox, ←/→ change the image, Escape closes.
// 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}` }));
</script>

<template>
  <ZGallery label="Product photos">
    <ZGalleryItem v-for="p in PHOTOS" :key="p.alt" :src="p.src" :alt="p.alt" />
  </ZGallery>
</template>

```

### Case: empty

#### Vue
```vue
<script setup lang="ts">
import { ZGallery } from '@zelviora/vue';

// No image: the gallery shows its empty text and `show()` does nothing.
</script>

<template>
  <ZGallery label="Empty album" />
</template>

```

### Case: i18n

#### Vue
```vue
<script setup lang="ts">
import { ZGallery, ZGalleryItem, ZStack } from '@zelviora/vue';

// Counter and buttons follow the locale ("Ảnh 2 trên 3"); in RTL ←/→ are swapped.
// 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}` }));
</script>

<template>
  <ZStack gap="lg">
    <div lang="vi">
      <ZGallery label="Tiếng Việt">
        <ZGalleryItem v-for="p in PHOTOS" :key="p.alt" :src="p.src" :alt="p.alt" />
      </ZGallery>
    </div>
    <div dir="rtl" lang="ar">
      <ZGallery label="RTL">
        <ZGalleryItem v-for="p in PHOTOS" :key="p.alt" :src="p.src" :alt="p.alt" />
      </ZGallery>
    </div>
  </ZStack>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZGallery, ZGalleryItem } from '@zelviora/vue';

// Captions, a loop through the images, and a broken image (the thumbnail and the lightbox keep the alt text).
// 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';
</script>

<template>
  <ZGallery label="Album" loop>
    <ZGalleryItem :src="pic('#bfdbfe', 'Front')" alt="Front" caption="Front" />
    <ZGalleryItem :src="pic('#fecaca', 'Back')" alt="Back" caption="Back" />
    <ZGalleryItem :src="BROKEN" alt="Broken image" caption="Image failed to load" />
  </ZGallery>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZGaugeChart } from '@zelviora/vue-chart';
import { gaugeValue, gaugeData, gaugeSeries } from '../data.ts';
</script>

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

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/vue';
import {
  ZGaugeChart,
  type ChartPointSelectDetail,
  type ChartSeriesToggleDetail,
} from '@zelviora/vue-chart';
import { gaugeValue, gaugeData, gaugeSeries } from '../data.ts';

const hidden = ref<string[]>([]);
const selected = ref('Click any chart element to inspect');

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

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

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" gap="sm" align-items="center" wrap>
      <ZButton size="sm" variant="outline" @click="hidden = []">
        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
      :hidden-series="hidden"
      @z-series-toggle="onToggle"
      @z-point-select="onSelect"
    />
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZGaugeChart } from '@zelviora/vue-chart';
import { gaugeValue, gaugeData, gaugeSeries } from '../data.ts';
</script>

<template>
  <ZGaugeChart
    class="demo-chart-brand"
    description="Real-time compute utilization across production worker nodes."
    :value-format="{ maximumFractionDigits: 1 }"
    :value="gaugeValue" :min="0" :max="100" unit="%" :split-number="4" renderer="canvas" :data="gaugeData" :series="gaugeSeries"
  >
    <span slot="heading">Cluster CPU Utilization — Custom Theme Tokens &amp; Canvas</span>
  </ZGaugeChart>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZGaugeChart } from '@zelviora/vue-chart';
import { gaugeValue, gaugeData, gaugeSeries } from '../data.ts';
</script>

<template>
  <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."
      show-data-table
      :value="gaugeValue" :min="0" :max="100" unit="%" :data="gaugeData" :series="gaugeSeries"
    />
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZGaugeChart } from '@zelviora/vue-chart';
import { gaugeValue, gaugeData, gaugeSeries } from '../data.ts';
</script>

<template>
  <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" :start-angle="180" :end-angle="0" :split-number="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="%" :show-progress="false" :split-number="10" :data="gaugeData" :series="gaugeSeries"
    />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZGraphChart } from '@zelviora/vue-chart';
import { graphCategories, graphNodes, graphLinks, graphSeries } from '../data.ts';
</script>

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

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/vue';
import {
  ZGraphChart,
  type ChartPointSelectDetail,
  type ChartSeriesToggleDetail,
} from '@zelviora/vue-chart';
import { graphCategories, graphNodes, graphLinks, graphSeries } from '../data.ts';

const hidden = ref<string[]>([]);
const selected = ref('Click any chart element to inspect');

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

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

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" gap="sm" align-items="center" wrap>
      <ZButton size="sm" variant="outline" @click="hidden = []">
        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
      :hidden-series="hidden"
      @z-series-toggle="onToggle"
      @z-point-select="onSelect"
    />
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZGraphChart } from '@zelviora/vue-chart';
import { graphCategories, graphNodes, graphLinks, graphSeries } from '../data.ts';
</script>

<template>
  <ZGraphChart
    class="demo-chart-brand"
    description="Directed call graph connecting ingress gateways, domain services, and storage engines."
    :value-format="{ 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>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZGraphChart } from '@zelviora/vue-chart';
import { graphCategories, graphNodes, graphLinks, graphSeries } from '../data.ts';
</script>

<template>
  <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."
      show-data-table
      :nodes="graphNodes" :links="graphLinks" :categories="graphCategories" :series="graphSeries"
    />
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZGraphChart } from '@zelviora/vue-chart';
import { graphCategories, graphNodes, graphLinks, graphSeries } from '../data.ts';
</script>

<template>
  <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" graph-layout="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" graph-layout="force" :repulsion="240" :symbol-size="20"
    />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
// min-column-width: as many columns of at least 10rem as fit; no breakpoints needed.
import { ZCard, ZGrid } from '@zelviora/vue';

const files = ['report.pdf', 'budget.xlsx', 'logo.svg', 'notes.md', 'photo.jpg', 'contract.docx', 'data.csv'];
</script>

<template>
  <ZGrid min-column-width="10rem" gap="sm">
    <ZCard v-for="file in files" :key="file" variant="soft" size="sm">{{ file }}</ZCard>
  </ZGrid>
</template>

```

### Case: basic

#### Vue
```vue
<script setup lang="ts">
// 12 columns by default; grid items span as many as they need.
import { ZCard, ZGrid, ZGridItem } from '@zelviora/vue';
</script>

<template>
  <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>
</template>

```

### Case: composition

#### Vue
```vue
<script setup lang="ts">
// Two-column form inside a md container; the address spans both columns.
import { useId } from 'vue';
import { ZButton, ZContainer, ZGrid, ZGridItem, ZLabel, ZStack } from '@zelviora/vue';

const id = useId();
</script>

<template>
  <ZContainer size="md" padding="none">
    <form @submit.prevent>
      <ZStack gap="lg">
        <ZGrid :columns="2">
          <ZStack gap="xs">
            <ZLabel :for="`${id}-first`">First name</ZLabel>
            <input :id="`${id}-first`" autocomplete="given-name" />
          </ZStack>
          <ZStack gap="xs">
            <ZLabel :for="`${id}-last`">Last name</ZLabel>
            <input :id="`${id}-last`" autocomplete="family-name" />
          </ZStack>
          <ZGridItem :span="2">
            <ZStack gap="xs">
              <ZLabel :for="`${id}-address`">Address</ZLabel>
              <input :id="`${id}-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>
</template>

```

### Case: gaps

#### Vue
```vue
<script setup lang="ts">
// gap sets both axes; row-gap and column-gap override one axis. All follow the density tokens.
import { ZCard, ZGrid, ZStack } from '@zelviora/vue';

const gaps = ['none', 'xs', 'sm', 'md', 'lg'] as const;
</script>

<template>
  <ZStack gap="lg">
    <ZGrid v-for="gap in gaps" :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" row-gap="lg" column-gap="xs">
      <ZCard v-for="n in ['1', '2', '3', '4', '5', '6']" :key="n" variant="soft" size="sm">rowGap lg, columnGap xs</ZCard>
    </ZGrid>
  </ZStack>
</template>

```

### Case: responsive

#### Vue
```vue
<script setup lang="ts">
/**
 * 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.
 */
import { ZCard, ZContainer, ZGrid } from '@zelviora/vue';

const plans = ['Free', 'Team', 'Business', 'Enterprise'];
</script>

<template>
  <ZContainer size="full" padding="none">
    <ZGrid columns="2 lg:4">
      <ZCard v-for="plan in plans" :key="plan" :heading="plan">Billed monthly.</ZCard>
    </ZGrid>
  </ZContainer>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZHeading, ZStack, ZText } from '@zelviora/vue';
</script>

<template>
  <ZStack gap="xs">
    <ZHeading :level="2">Revenue report</ZHeading>
    <ZText as="p" variant="muted">Figures updated at 08:00, Q3 2026.</ZText>
  </ZStack>
</template>

```

### Case: prose

#### Vue
```vue
<script setup lang="ts">
// Plain HTML styled by the `.z-prose` class of @zelviora/tokens/prose.css.
</script>

<template>
  <article class="z-prose">
    <h2>Changing your password</h2>
    <p>A new password needs at least <strong>8 characters</strong>. See also <a href="#security">the security policy</a>.</p>
    <ol>
      <li>Open the Account page.</li>
      <li>Choose Security, then Change password.</li>
    </ol>
    <blockquote>Do not reuse the password of another account.</blockquote>
    <pre><code>npm install @zelviora/vue</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>
</template>

```

### Case: sizes

#### Vue
```vue
<script setup lang="ts">
import { ZHeading, ZStack } from '@zelviora/vue';

const sizes = ['xl', 'lg', 'md', 'sm'] as const;
</script>

<template>
  <ZStack gap="sm">
    <ZHeading v-for="size in sizes" :key="size" :level="3" :size="size">Level 3 heading, size {{ size }}</ZHeading>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZHeatmapChart } from '@zelviora/vue-chart';
import { heatmapData, heatmapSeries } from '../data.ts';
</script>

<template>
  <ZHeatmapChart
    heading="Deployment Frequency by Day and Environment"
    description="Number of automated releases across Staging, Canary, and Production from Monday to Friday."
    x-key="day" y-key="env" value-key="deploys" :data="heatmapData" :series="heatmapSeries"
  />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/vue';
import {
  ZHeatmapChart,
  type ChartPointSelectDetail,
  type ChartSeriesToggleDetail,
} from '@zelviora/vue-chart';
import { heatmapData, heatmapSeries } from '../data.ts';

const hidden = ref<string[]>([]);
const selected = ref('Click any chart element to inspect');

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

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

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" gap="sm" align-items="center" wrap>
      <ZButton size="sm" variant="outline" @click="hidden = []">
        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."
      x-key="day" y-key="env" value-key="deploys" :data="heatmapData" :series="heatmapSeries"
      selectable
      :hidden-series="hidden"
      @z-series-toggle="onToggle"
      @z-point-select="onSelect"
    />
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZHeatmapChart } from '@zelviora/vue-chart';
import { heatmapData, heatmapSeries } from '../data.ts';
</script>

<template>
  <ZHeatmapChart
    class="demo-chart-brand"
    description="Number of automated releases across Staging, Canary, and Production from Monday to Friday."
    :value-format="{ maximumFractionDigits: 1 }"
    x-key="day" y-key="env" value-key="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>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZHeatmapChart } from '@zelviora/vue-chart';
import { heatmapData, heatmapSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZHeatmapChart
      heading="Loading State (aria-busy)"
      loading
      x-key="day" y-key="env" value-key="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."
      show-data-table
      x-key="day" y-key="env" value-key="deploys" :data="heatmapData" :series="heatmapSeries"
    />
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZHeatmapChart } from '@zelviora/vue-chart';
import { heatmapData, heatmapSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZHeatmapChart
      heading="Labeled Matrix with Bounds"
      description="Labeled cells with explicit color scale domain vs unlabeled compact matrix."
      x-key="day" y-key="env" value-key="deploys" :min="0" :max="50" show-label :data="heatmapData" :series="heatmapSeries"
    />
    <ZHeatmapChart
      heading="Unlabeled Color Matrix"
      description="Labeled cells with explicit color scale domain vs unlabeled compact matrix."
      x-key="day" y-key="env" value-key="deploys" :show-label="false" :data="heatmapData" :series="heatmapSeries"
    />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZAvatar, ZHoverCard, ZStack, ZText } from '@zelviora/vue';
</script>

<template>
  <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>
</template>

```

### Case: placement

#### Vue
```vue
<script setup lang="ts">
import { ZHoverCard, ZStack } from '@zelviora/vue';

const placements = ['top', 'right', 'bottom', 'left'] as const;
</script>

<template>
  <ZStack orientation="horizontal" wrap align-items="center" gap="lg">
    <ZHoverCard v-for="placement in placements" :key="placement" :placement="placement" arrow :open-delay="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>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZIcon } from '@zelviora/vue';
</script>

<template>
  <p>Continue to checkout <ZIcon name="chevron_right" /></p>
</template>

```

### Case: composition

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZIcon, ZIconButton, ZInput, ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack } from '@zelviora/vue';

// The icon inside other components: the icon slot of a button, an icon button, the prefix of an input and sidebar items.
</script>

<template>
  <ZStack gap="lg">
    <ZStack orientation="horizontal" align-items="center" gap="md" wrap>
      <ZButton>
        <ZIcon slot="icon-start" name="save" />
        Save
      </ZButton>
      <ZIconButton label="Settings">
        <ZIcon name="settings" />
      </ZIconButton>
    </ZStack>
    <ZInput class="demo-narrow" label="Search" placeholder="Search orders">
      <ZIcon slot="prefix" name="search" />
    </ZInput>
    <ZStack orientation="horizontal" class="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 class="demo-grow">Page content</p>
    </ZStack>
  </ZStack>
</template>

```

### Case: label

#### Vue
```vue
<script setup lang="ts">
import { ZIcon } from '@zelviora/vue';
</script>

<template>
  <p>Payment status: <ZIcon name="close" label="Failed" size="md" /></p>
</template>

```

### Case: loading

#### Vue
```vue
<script setup lang="ts">
import { ZIcon, ZStack } from '@zelviora/vue';

// Same-origin sample picture served by the docs site (apps/document/public/demo-assets).
const SAMPLE = '/demo-assets/rich-text-sample.svg';
</script>

<template>
  <ZStack orientation="horizontal" align-items="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>
</template>

```

### Case: registry

#### Vue
```vue
<script setup lang="ts">
import { ZIcon } from '@zelviora/vue';
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,
  },
});
</script>

<template>
  <p><ZIcon name="app-send" size="md" /> Send message</p>
</template>

```

### Case: rtl

#### Vue
```vue
<script setup lang="ts">
import { ZIcon, ZStack } from '@zelviora/vue';
</script>

<template>
  <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>
</template>

```

### Case: sizes

#### Vue
```vue
<script setup lang="ts">
import { ZIcon, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZStack orientation="horizontal" align-items="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>
</template>

```

### Case: styles

#### Vue
```vue
<script setup lang="ts">
import { ZIcon, ZStack } from '@zelviora/vue';
</script>

<template>
  <!-- Font styles and axes of the icon font: classes of demo.css set the icon tokens (see README). -->
  <ZStack orientation="horizontal" align-items="center" gap="lg" wrap>
    <span><ZIcon name="settings" size="lg" /> Outlined (brand default)</span>
    <span><ZIcon name="settings" size="lg" class="demo-icon-rounded" /> Rounded</span>
    <span><ZIcon name="settings" size="lg" class="demo-icon-sharp" /> Sharp</span>
    <span><ZIcon name="star" size="lg" filled /> Filled</span>
    <span><ZIcon name="star" size="lg" class="demo-icon-bold" /> Weight 700</span>
  </ZStack>
</template>

```

### Case: tones

#### Vue
```vue
<script setup lang="ts">
import { ZIcon, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZStack orientation="horizontal" align-items="center" gap="lg" wrap>
    <!-- demo.css: .demo-text-destructive sets the text color; .demo-icon-token sets --z-icon-color. -->
    <span class="demo-text-destructive"><ZIcon name="close" size="md" /> Inherits the text color</span>
    <span><ZIcon name="close" size="md" class="demo-icon-token" /> Icon color token</span>
  </ZStack>
</template>

```

### Case: unknown

#### Vue
```vue
<script setup lang="ts">
import { ZIcon, ZStack } from '@zelviora/vue';

// A name that is neither registered nor in the icon font leaves an empty box of the icon size (dev warning in the console).
</script>

<template>
  <ZStack orientation="horizontal" align-items="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>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZIcon, ZIconButton } from '@zelviora/vue';

const onClose = () => console.log('closed');
</script>

<template>
  <ZIconButton label="Close" @click="onClose">
    <ZIcon name="close" />
  </ZIconButton>
</template>

```

### Case: loading

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZIcon, ZIconButton } from '@zelviora/vue';

const loading = ref(false);

function remove() {
  loading.value = true;
  setTimeout(() => (loading.value = false), 1500);
}
</script>

<template>
  <ZIconButton label="Delete" variant="soft" tone="destructive" :loading="loading" @click="remove">
    <ZIcon name="close" />
  </ZIconButton>
</template>

```

### Case: sizes

#### Vue
```vue
<script setup lang="ts">
import { ZIcon, ZIconButton, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZStack orientation="horizontal" align-items="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>
</template>

```

### Case: spa-routing

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZIcon, ZIconButton } from '@zelviora/vue';

const route = ref('#/home');
// One zNavigate listener calls the app router (stand-in for `router.push` of Vue Router).
function navigate(e: CustomEvent<{ href: string }>) {
  e.preventDefault();
  route.value = e.detail.href; // router.push(e.detail.href)
}
</script>

<template>
  <div>
    <ZIconButton label="Settings" href="#/settings" @z-navigate="navigate">
      <ZIcon name="settings" />
    </ZIconButton>
    <p aria-live="polite">Current route: <code>{{ route }}</code></p>
  </div>
</template>

```

### Case: tooltip

#### Vue
```vue
<script setup lang="ts">
import { ZIcon, ZIconButton, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZStack orientation="horizontal" align-items="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>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZIcon, ZIconButton, ZStack } from '@zelviora/vue';

const variants = ['solid', 'soft', 'outline', 'ghost', 'dashed'] as const;
</script>

<template>
  <ZStack orientation="horizontal" align-items="center" gap="md" wrap>
    <ZIconButton v-for="variant in variants" :key="variant" :label="`Close (${variant})`" :variant="variant" tone="primary">
      <ZIcon name="close" />
    </ZIconButton>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZIconPicker, ZStack } from '@zelviora/vue';

const value = ref('star');
const open = ref(false);
const log = ref<string[]>([]);
const add = (line: string) => { log.value = [line, ...log.value].slice(0, 5); };
</script>

<template>
  <ZStack class="demo-narrow">
    <ZIconPicker
      label="Controlled icon"
      :value="value"
      :open="open"
      clearable
      show-name
      @zInput="(e: any) => { value = e.detail.value; add(`zInput ${e.detail.value || '(none)'}`); }"
      @zChange="(e: any) => { value = e.detail.value; add(`zChange ${e.detail.value || '(none)'}`); }"
      @zOpenChange="(e: any) => { open = e.detail.open; add(`zOpenChange ${e.detail.open} (${e.detail.reason})`); }"
      @zSearch="(e: any) => add(`zSearch &quot;${e.detail.query}&quot;`)"
    />
    <ZStack orientation="horizontal" gap="sm" wrap>
      <ZButton variant="outline" tone="neutral" @click="open = !open">
        {{ open ? 'Close' : 'Open' }}
      </ZButton>
      <ZButton variant="outline" tone="neutral" @click="value = 'shopping_cart'">
        Select cart
      </ZButton>
      <ZButton variant="outline" tone="neutral" @click="value = ''">
        Clear
      </ZButton>
    </ZStack>
    <span>Value: {{ value || "''" }}</span>
    <output>{{ log.join(' · ') }}</output>
  </ZStack>
</template>

```

### Case: custom-icons

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZIconPicker, ZStack } from '@zelviora/vue';

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',
];
const icon = ref('play_arrow');
</script>

<template>
  <ZStack class="demo-narrow">
    <ZIconPicker
      v-model="icon"
      label="Media Player Icon"
      :icons="MEDIA_ICONS"
      :page-size="8"
      show-name
      clearable
      empty-text="No media icon matches search"
    />
    <span>Selected: {{ icon || '(none)' }}</span>
  </ZStack>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZIconPicker, ZStack } from '@zelviora/vue';

const value = ref('favorite');
</script>

<template>
  <ZStack class="demo-narrow">
    <ZIconPicker
      v-model="value"
      label="Favorite icon"
      placeholder="Choose an icon..."
      clearable
      show-name
    />
    <span>Selected: {{ value || '(none)' }}</span>
  </ZStack>
</template>

```

### Case: form

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZField, ZIconPicker, ZStack } from '@zelviora/vue';

const sent = ref('');
const submit = (e: Event) => {
  e.preventDefault();
  sent.value = JSON.stringify([...new FormData(e.target as HTMLFormElement).entries()]);
};
</script>

<template>
  <form class="demo-narrow" @submit="submit">
    <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" default-value="add" />
      <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
        <ZButton type="submit">Submit</ZButton>
        <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
      </ZStack>
      <output v-if="sent">{{ sent }}</output>
    </ZStack>
  </form>
</template>

```

### Case: i18n

#### Vue
```vue
<script setup lang="ts">
import { ZConfigProvider, ZGrid, ZIconPicker } from '@zelviora/vue';
</script>

<template>
  <ZGrid columns="1 sm:3" gap="md">
    <ZConfigProvider locale="vi">
      <ZIconPicker label="Tiếng Việt" default-value="settings" />
    </ZConfigProvider>
    <ZConfigProvider locale="en">
      <ZIconPicker label="English" default-value="settings" />
    </ZConfigProvider>
    <div dir="rtl" lang="ar-EG">
      <ZIconPicker label="العربية" default-value="settings" />
    </div>
  </ZGrid>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZGrid, ZIconPicker } from '@zelviora/vue';
</script>

<template>
  <ZGrid columns="1 sm:2" gap="md">
    <ZIconPicker label="Empty" placeholder="No icon selected" />
    <ZIconPicker label="With value" default-value="star" />
    <ZIconPicker label="Clearable" default-value="search" clearable />
    <ZIconPicker label="Disabled" default-value="lock" disabled />
    <ZIconPicker label="Readonly" default-value="visibility" readonly />
    <ZIconPicker label="Invalid" default-value="" placeholder="Required" invalid />
    <ZIconPicker label="Warning" default-value="warning" status="warning" />
    <ZIconPicker label="Success" default-value="check_circle" status="success" />
  </ZGrid>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZGrid, ZIconPicker, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZStack gap="lg">
    <ZGrid columns="1 sm:3" gap="md">
      <ZIconPicker label="Small" size="sm" default-value="home" />
      <ZIconPicker label="Medium" size="md" default-value="home" />
      <ZIconPicker label="Large" size="lg" default-value="home" />
      <ZIconPicker label="Small filled" size="sm" variant="filled" default-value="settings" />
      <ZIconPicker label="Medium filled" size="md" variant="filled" default-value="settings" />
      <ZIconPicker label="Large filled" size="lg" variant="filled" default-value="settings" />
    </ZGrid>
    <ZIconPicker label="Inline" inline default-value="palette" :page-size="30" />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZGrid, ZImage, ZStack, ZText } from '@zelviora/vue';

// 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 BROKEN = 'data:image/png;base64,AAAA';
const fits = ['cover', 'contain', 'fill', 'none', 'scale-down'] as const;
</script>

<template>
  <ZGrid columns="2 md:4" gap="md">
    <ZStack v-for="fit in fits" :key="fit" gap="xs">
      <ZImage class="demo-square" :src="PICTURE" :alt="`Red circle, fit ${fit}`" :fit="fit" />
      <ZText variant="muted">{{ fit }}</ZText>
    </ZStack>
    <ZStack gap="xs">
      <ZImage class="demo-square" :src="BROKEN" :fallback-src="PICTURE" alt="Fallback picture" />
      <ZText variant="muted">fallbackSrc</ZText>
    </ZStack>
    <ZStack gap="xs">
      <ZImage class="demo-square" :src="BROKEN" alt="Product photo" />
      <ZText variant="muted">error</ZText>
    </ZStack>
  </ZGrid>
</template>

```

### Case: preview

#### Vue
```vue
<script setup lang="ts">
import { ZImage } from '@zelviora/vue';

// Sample picture kept in the demo (no external image, demo-standards §5).
// Click, Enter or Space opens the preview: zoom with + / − or the wheel, rotate with r, pan with the arrow keys.
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";
</script>

<template>
  <ZImage :src="PHOTO" alt="Mountains under a yellow sun" :width="320" :height="213" preview />
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZInput } from '@zelviora/vue';
</script>

<template>
  <ZInput label="Full name" name="fullName" placeholder="Nguyen Van A" autocomplete="name" />
</template>

```

### Case: clearable

#### Vue
```vue
<script setup lang="ts">
import { ZInput, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZStack class="demo-narrow">
    <ZInput label="Dish" clearable show-count :max-length="20" value="Pho 🍜" hint="Length counts characters as you see them" />
    <ZInput label="Search" type="search" clearable placeholder="Press Escape to clear" />
  </ZStack>
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { computed, ref } from 'vue';
import { ZInput, ZStack } from '@zelviora/vue';

const value = ref('');
const committed = ref('');
// v-model through a computed setter: the app upper-cases every input before it reaches the element.
const code = computed({
  get: () => value.value,
  set: (v: string) => {
    value.value = v.toUpperCase();
  },
});

function onChange(e: CustomEvent<{ value: string }>) {
  committed.value = e.detail.value;
}
</script>

<template>
  <ZStack gap="sm" class="demo-narrow">
    <ZInput v-model="code" label="Coupon code" @z-change="onChange" />
    <small>Value: {{ value || '—' }} · Last change: {{ committed || '—' }}</small>
  </ZStack>
</template>

```

### Case: error

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZInput, ZStack } from '@zelviora/vue';
</script>

<template>
  <form class="demo-narrow" @submit.prevent>
    <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" value="example" />
      <ZInput label="Username" name="user" status="warning" hint="This name is similar to an existing one" value="an.nguyen" />
      <ZButton type="submit">Submit</ZButton>
    </ZStack>
  </form>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZInput, ZInputGroup, ZInputGroupAddon } from '@zelviora/vue';
</script>

<template>
  <div class="demo-narrow">
    <ZInputGroup label="Website">
      <ZInputGroupAddon>https://</ZInputGroupAddon>
      <ZInput name="site" label="Domain name" placeholder="example" />
      <ZInputGroupAddon>.com</ZInputGroupAddon>
    </ZInputGroup>
  </div>
</template>

```

### Case: composition

#### Vue
```vue
<script setup lang="ts">
import { computed, ref } from 'vue';
import { ZButton, ZField, ZInput, ZInputGroup, ZSelect, ZSelectOption, ZStack } from '@zelviora/vue';

const code = ref('SALE');
// v-model through a computed setter: the app upper-cases the code.
const coupon = computed({
  get: () => code.value,
  set: (v: string) => {
    code.value = v.toUpperCase();
  },
});
const error = computed(() => (code.value.trim().length < 6 ? 'The code has 6 characters.' : null));
</script>

<template>
  <ZStack gap="lg" class="demo-narrow">
    <ZInputGroup label="Price">
      <ZSelect label="Currency" value="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 v-model="coupon" name="coupon" />
        <ZButton variant="outline" tone="neutral">Apply</ZButton>
      </ZInputGroup>
    </ZField>
  </ZStack>
</template>

```

### Case: controls

#### Vue
```vue
<script setup lang="ts">
import { ZCombobox, ZDatePicker, ZInputGroup, ZInputGroupAddon, ZNumberInput, ZStack } from '@zelviora/vue';

const currencies = [
  { value: 'vnd', label: 'VND' },
  { value: 'usd', label: 'USD' },
  { value: 'eur', label: 'EUR' },
];
</script>

<!-- Combobox, number-input and date-picker join like the input: square inner corners, one shared border; RTL mirrors them. -->
<template>
  <ZStack gap="lg">
    <ZInputGroup label="Transfer">
      <ZCombobox label="Currency" :options="currencies" value="vnd" />
      <ZNumberInput label="Amount" :value="250000" :min="0" />
      <ZDatePicker label="Transfer date" />
    </ZInputGroup>
    <ZInputGroup label="Discount" size="sm">
      <ZNumberInput label="Discount" :value="10" :min="0" :max="100" />
      <ZInputGroupAddon>%</ZInputGroupAddon>
    </ZInputGroup>
    <div dir="rtl">
      <ZInputGroup label="المبلغ">
        <ZInputGroupAddon>د.إ</ZInputGroupAddon>
        <ZNumberInput label="المبلغ" :value="1200" />
        <ZDatePicker label="التاريخ" />
      </ZInputGroup>
    </div>
  </ZStack>
</template>

```

### Case: disabled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZInput, ZInputGroup, ZStack, ZSwitch } from '@zelviora/vue';

const disabled = ref(true);
</script>

<template>
  <ZStack gap="md" class="demo-narrow">
    <ZSwitch v-model="disabled">Disable the group</ZSwitch>
    <ZInputGroup label="Search" :disabled="disabled">
      <ZInput type="search" label="Search" name="q" value="invoices" />
      <ZButton>Search</ZButton>
    </ZInputGroup>
  </ZStack>
</template>

```

### Case: sizes

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZInput, ZInputGroup, ZInputGroupAddon, ZStack } from '@zelviora/vue';

const sizes = ['sm', 'md', 'lg'] as const;
</script>

<template>
  <ZStack gap="md" class="demo-narrow">
    <ZInputGroup v-for="size in sizes" :key="size" :size="size" :label="`Amount ${size}`">
      <ZInputGroupAddon>₫</ZInputGroupAddon>
      <ZInput :label="`Amount (${size})`" placeholder="0" />
      <ZButton variant="outline" tone="neutral">Apply</ZButton>
    </ZInputGroup>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZKanban, ZKanbanCard, ZKanbanColumn, ZStack, ZText } from '@zelviora/vue';
import { cancelledLog, controlledDemo, dragStartLog, findCard, moveCard, reorderLog, type ReorderDetail } from '../data.ts';

const board = ref(controlledDemo.columns);
const log = ref(controlledDemo.initialLog);

function onDragStart(e: CustomEvent<{ value: string; reason: string }>) {
  log.value = dragStartLog(e.detail);
}

// `zReorder` is cancelable: preventDefault() announces "cancelled" and the card flies back; otherwise update the data.
function onReorder(e: CustomEvent<ReorderDetail>) {
  const d = e.detail;
  const card = findCard(board.value, d.from, d.value);
  if (card?.blocked && d.to !== d.from) {
    e.preventDefault();
    log.value = cancelledLog(card);
    return;
  }
  board.value = moveCard(board.value, d);
  log.value = reorderLog(d);
}
</script>

<template>
  <ZStack gap="sm">
    <ZKanban :label="controlledDemo.label" @z-drag-start="onDragStart" @z-reorder="onReorder">
      <ZKanbanColumn v-for="col in board" :key="col.value" :value="col.value" :label="col.label">
        <ZKanbanCard v-for="card in col.cards" :key="card.value" :value="card.value" :label="card.label">
          <ZStack gap="xs" align-items="start">
            <ZText>{{ card.label }}</ZText>
            <ZBadge v-if="card.blocked" tone="destructive">{{ controlledDemo.blocked }}</ZBadge>
            <ZBadge v-else>{{ card.tag }}</ZBadge>
          </ZStack>
        </ZKanbanCard>
      </ZKanbanColumn>
    </ZKanban>
    <ZText variant="muted" size="sm">{{ log }}</ZText>
  </ZStack>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZKanban, ZKanbanCard, ZKanbanColumn, ZStack, ZText } from '@zelviora/vue';
import { defaultDemo, moveCard, type ReorderDetail } from '../data.ts';

const board = ref(defaultDemo.columns);

// The kanban does not move cards itself: update the data on `zReorder` and let Vue render the new order.
// Drag with the pointer, or focus a handle: Space / Enter lifts, the arrows move, Space / Enter drops, Escape cancels.
function onReorder(e: CustomEvent<ReorderDetail>) {
  board.value = moveCard(board.value, e.detail);
}
</script>

<template>
  <ZKanban :label="defaultDemo.label" @z-reorder="onReorder">
    <ZKanbanColumn v-for="col in board" :key="col.value" :value="col.value" :label="col.label">
      <ZKanbanCard v-for="card in col.cards" :key="card.value" :value="card.value" :label="card.label">
        <ZStack gap="xs" align-items="start">
          <ZText>{{ card.label }}</ZText>
          <ZBadge>{{ card.tag }}</ZBadge>
        </ZStack>
      </ZKanbanCard>
    </ZKanbanColumn>
  </ZKanban>
</template>

```

### Case: limits

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZKanban, ZKanbanCard, ZKanbanColumn, ZStack, ZText } from '@zelviora/vue';
import { fromReview, limitsDemo, moveCard, type ReorderDetail } from '../data.ts';

// `limit` shows "count/limit" and the over-limit state without blocking drops; `accepts` (pure predicate, PR-7)
// refuses drops; `handle`: the pointer drags only from the grip. The first backlog card is disabled; Done starts empty.
const board = ref(limitsDemo.columns);

function onReorder(e: CustomEvent<ReorderDetail>) {
  board.value = moveCard(board.value, e.detail);
}
</script>

<template>
  <ZKanban :label="limitsDemo.label" handle @z-reorder="onReorder">
    <ZKanbanColumn v-for="col in board" :key="col.value" :value="col.value" :label="col.label"
      :limit="col.value === limitsDemo.limitColumn ? limitsDemo.limit : undefined"
      :accepts="col.value === limitsDemo.acceptsColumn ? fromReview : undefined">
      <ZKanbanCard v-for="card in col.cards" :key="card.value" :value="card.value" :label="card.label" :disabled="card.disabled">
        <ZStack gap="xs" align-items="start">
          <ZText>{{ card.label }}</ZText>
          <ZBadge>{{ card.tag }}</ZBadge>
        </ZStack>
      </ZKanbanCard>
      <ZText slot="empty" variant="muted" size="sm">{{ limitsDemo.empty }}</ZText>
    </ZKanbanColumn>
  </ZKanban>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZKbd, ZStack, ZText } from '@zelviora/vue';
</script>

<template>
  <ZStack orientation="horizontal" gap="sm" align-items="center" :wrap="true">
    <ZText>Close with</ZText>
    <ZKbd>Esc</ZKbd>
    <ZText>Search with</ZText>
    <ZKbd keys="Mod+K"></ZKbd>
  </ZStack>
</template>

```

### Case: composition

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZCard, ZKbd, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZCard heading="Editor">
    <ZStack orientation="horizontal" gap="sm" align-items="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 class="demo-kbd-brand" keys="Shift+Enter"></ZKbd>
    </ZStack>
  </ZCard>
</template>

```

### Case: sizes

#### Vue
```vue
<script setup lang="ts">
import { ZKbd, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZStack orientation="horizontal" gap="md" align-items="center">
    <ZKbd keys="Mod+S" size="sm"></ZKbd>
    <ZKbd keys="Mod+S" size="md"></ZKbd>
    <ZKbd keys="Mod+S" size="lg"></ZKbd>
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZKbd, ZStack, ZText } from '@zelviora/vue';
</script>

<template>
  <ZStack gap="sm">
    <ZStack orientation="horizontal" gap="sm" align-items="center"><ZText>Symbols</ZText><ZKbd keys="Mod+Shift+P" display="symbols"></ZKbd></ZStack>
    <ZStack orientation="horizontal" gap="sm" align-items="center"><ZText>Text</ZText><ZKbd keys="Mod+Shift+P" display="text"></ZKbd></ZStack>
    <ZStack orientation="horizontal" gap="sm" align-items="center"><ZText>Long</ZText><ZKbd keys="Mod+Shift+Alt+ArrowUp"></ZKbd></ZStack>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { useId } from 'vue';
import { ZLabel, ZStack } from '@zelviora/vue';

const id = useId();
</script>

<template>
  <ZStack gap="xs" class="demo-narrow">
    <ZLabel :for="`${id}-email`">Email</ZLabel>
    <input :id="`${id}-email`" type="email" />
  </ZStack>
</template>

```

### Case: checkbox

#### Vue
```vue
<script setup lang="ts">
import { useId } from 'vue';
import { ZLabel, ZStack } from '@zelviora/vue';

const id = useId();
</script>

<template>
  <ZStack orientation="horizontal" align-items="center" gap="sm">
    <input :id="`${id}-terms`" type="checkbox" />
    <ZLabel :for="`${id}-terms`">I accept the terms</ZLabel>
  </ZStack>
</template>

```

### Case: indicators

#### Vue
```vue
<script setup lang="ts">
import { useId } from 'vue';
import { ZLabel, ZStack } from '@zelviora/vue';

const id = useId();
</script>

<template>
  <ZStack gap="md" class="demo-narrow">
    <ZStack gap="xs">
      <ZLabel :for="`${id}-name`" required>Full name</ZLabel>
      <input :id="`${id}-name`" required aria-required="true" />
    </ZStack>
    <ZStack gap="xs">
      <ZLabel :for="`${id}-phone`" optional>Phone</ZLabel>
      <input :id="`${id}-phone`" type="tel" />
    </ZStack>
    <ZStack gap="xs">
      <ZLabel :for="`${id}-code`" disabled>Promo code</ZLabel>
      <input :id="`${id}-code`" disabled />
    </ZStack>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZLayout, ZLayoutContent, ZLayoutFooter, ZLayoutHeader, ZText } from '@zelviora/vue';
// Demos sit inside the docs page, which has its own landmarks: the inner ones are switched off.
</script>

<template>
  <ZLayout>
    <ZLayoutHeader disable-landmark>
      <ZText variant="strong">Acme Admin</ZText>
    </ZLayoutHeader>
    <ZLayoutContent disable-landmark>
      <ZText as="p" class="demo-pane">Twelve orders are waiting to be shipped today.</ZText>
    </ZLayoutContent>
    <ZLayoutFooter disable-landmark>© 2026 Acme</ZLayoutFooter>
  </ZLayout>
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZLayout, ZLayoutContent, ZLayoutSider, ZStack, ZText } from '@zelviora/vue';

// v-model binds the sider `collapsed` through `zCollapseChange`.
const collapsed = ref(false);
</script>

<template>
  <ZStack gap="sm">
    <ZStack orientation="horizontal" align-items="center" gap="sm">
      <ZButton size="sm" variant="outline" tone="neutral" @click="collapsed = !collapsed">
        {{ collapsed ? 'Show filters' : 'Hide filters' }}
      </ZButton>
      <ZText variant="muted" size="sm">collapsed = {{ String(collapsed) }}</ZText>
    </ZStack>
    <ZLayout>
      <ZLayoutSider v-model="collapsed" collapsible collapsed-width="0" label="Demo filters">
        <ZText as="p" size="sm">Filters</ZText>
      </ZLayoutSider>
      <ZLayoutContent disable-landmark>
        <ZText as="p">With a collapsed width of 0 the sider content is inert while hidden.</ZText>
      </ZLayoutContent>
    </ZLayout>
  </ZStack>
</template>

```

### Case: sider

#### Vue
```vue
<script setup lang="ts">
import { ZLayout, ZLayoutContent, ZLayoutHeader, ZLayoutSider, ZLink, ZStack, ZText } from '@zelviora/vue';
</script>

<template>
  <ZLayout>
    <ZLayoutHeader disable-landmark>
      <ZText variant="strong">Acme Admin</ZText>
    </ZLayoutHeader>
    <ZLayout>
      <ZLayoutSider collapsible landmark-role="navigation" label="Demo navigation" width="200px">
        <ZStack gap="xs" class="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 disable-landmark>
        <ZText as="p" class="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" landmark-role="complementary" label="Demo details" width="160px">
        <ZText variant="muted" size="sm" class="demo-pane">Order #1042: paid, ships today.</ZText>
      </ZLayoutSider>
    </ZLayout>
  </ZLayout>
</template>

```

### Case: sticky

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZLayout, ZLayoutContent, ZLayoutHeader, ZStack, ZText } from '@zelviora/vue';

const rows = Array.from({ length: 12 }, (_, i) => i + 1);
</script>

<template>
  <ZLayout>
    <ZLayoutHeader sticky disable-landmark>
      <ZText variant="strong">Sticky header</ZText>
    </ZLayoutHeader>
    <ZLayoutContent disable-landmark>
      <ZStack gap="sm">
        <ZStack v-for="n in rows" :key="n" orientation="horizontal" align-items="center" gap="sm">
          <ZText>Row {{ n }}</ZText>
          <ZButton size="sm" variant="ghost" tone="neutral">Open {{ n }}</ZButton>
        </ZStack>
      </ZStack>
    </ZLayoutContent>
  </ZLayout>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZLineChart } from '@zelviora/vue-chart';
import { trafficData, trafficSeries } from '../data.ts';
</script>

<template>
  <ZLineChart
    heading="Monthly Active Users by Platform (Thousands)"
    description="Web and Mobile active users grows steadily from January to June."
    x-key="month" :data="trafficData" :series="trafficSeries"
  />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/vue';
import {
  ZLineChart,
  type ChartPointSelectDetail,
  type ChartSeriesToggleDetail,
} from '@zelviora/vue-chart';
import { trafficData, trafficSeries } from '../data.ts';

const hidden = ref<string[]>([]);
const selected = ref('Click any chart element to inspect');

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

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

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" gap="sm" align-items="center" wrap>
      <ZButton size="sm" variant="outline" @click="hidden = []">
        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."
      x-key="month" :data="trafficData" :series="trafficSeries"
      selectable
      :hidden-series="hidden"
      @z-series-toggle="onToggle"
      @z-point-select="onSelect"
    />
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZLineChart } from '@zelviora/vue-chart';
import { trafficData, trafficSeries } from '../data.ts';
</script>

<template>
  <ZLineChart
    class="demo-chart-brand"
    description="Web and Mobile active users grows steadily from January to June."
    :value-format="{ maximumFractionDigits: 1 }"
    x-key="month" :data="trafficData" :series="trafficSeries" smooth data-zoom tooltip-mode="point" renderer="canvas"
  >
    <span slot="heading">Monthly Active Users by Platform (Thousands) — Custom Theme Tokens &amp; Canvas</span>
  </ZLineChart>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZLineChart } from '@zelviora/vue-chart';
import { trafficData, trafficSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZLineChart
      heading="Loading State (aria-busy)"
      loading
      x-key="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."
      show-data-table
      x-key="month" :data="trafficData" :series="trafficSeries"
    />
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZLineChart } from '@zelviora/vue-chart';
import { trafficData, trafficSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZLineChart
      heading="Smooth Spline Line"
      description="Smooth spline interpolation with enlarged symbols vs step-middle line progression."
      x-key="month" :data="trafficData" :series="trafficSeries" smooth :symbol-size="8"
    />
    <ZLineChart
      heading="Step-Middle Line"
      description="Smooth spline interpolation with enlarged symbols vs step-middle line progression."
      x-key="month" :data="trafficData" :series="trafficSeries" step="middle" connect-nulls
    />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZLinesChart } from '@zelviora/vue-chart';
import { routeLines, routeSeries } from '../data.ts';
</script>

<template>
  <ZLinesChart
    heading="Inter-Region Replication Routes"
    description="Data replication trajectories connecting regional hubs with animated flow particles."
    :lines-data="routeLines" :series="routeSeries"
  />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/vue';
import {
  ZLinesChart,
  type ChartPointSelectDetail,
  type ChartSeriesToggleDetail,
} from '@zelviora/vue-chart';
import { routeLines, routeSeries } from '../data.ts';

const hidden = ref<string[]>([]);
const selected = ref('Click any chart element to inspect');

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

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

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" gap="sm" align-items="center" wrap>
      <ZButton size="sm" variant="outline" @click="hidden = []">
        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."
      :lines-data="routeLines" :series="routeSeries"
      selectable
      :hidden-series="hidden"
      @z-series-toggle="onToggle"
      @z-point-select="onSelect"
    />
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZLinesChart } from '@zelviora/vue-chart';
import { routeLines, routeSeries } from '../data.ts';
</script>

<template>
  <ZLinesChart
    class="demo-chart-brand"
    description="Data replication trajectories connecting regional hubs with animated flow particles."
    :value-format="{ maximumFractionDigits: 1 }"
    :lines-data="routeLines" :series="routeSeries" effect-show :curveness="0.28" renderer="canvas"
  >
    <span slot="heading">Inter-Region Replication Routes — Custom Theme Tokens &amp; Canvas</span>
  </ZLinesChart>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZLinesChart } from '@zelviora/vue-chart';
import { routeLines, routeSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZLinesChart
      heading="Loading State (aria-busy)"
      loading
      :lines-data="routeLines" :series="routeSeries"
    />
    <ZLinesChart
      heading="Empty State"
      :lines-data="[]"
      :series="routeSeries"
    />
    <ZLinesChart
      heading="Expanded Accessible Data Table"
      description="Data replication trajectories connecting regional hubs with animated flow particles."
      show-data-table
      :lines-data="routeLines" :series="routeSeries"
    />
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZLinesChart } from '@zelviora/vue-chart';
import { routeLines, routeSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZLinesChart
      heading="Animated Curved Trajectories"
      description="Animated particle trail with high curvature vs static straight trajectory lines."
      :lines-data="routeLines" :series="routeSeries" effect-show :curveness="0.35"
    />
    <ZLinesChart
      heading="Static Direct Vectors"
      description="Animated particle trail with high curvature vs static straight trajectory lines."
      :lines-data="routeLines" :series="routeSeries" :effect-show="false" :curveness="0"
    />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZLink } from '@zelviora/vue';
</script>

<template>
  <p>Read the <ZLink href="#details">details</ZLink> before you continue.</p>
</template>

```

### Case: external

#### Vue
```vue
<script setup lang="ts">
import { ZLink } from '@zelviora/vue';
</script>

<template>
  <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>
</template>

```

### Case: spa-routing

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZLink } from '@zelviora/vue';

const route = ref('#/home');
// One zNavigate listener calls the app router (stand-in for `router.push` of Vue Router).
function navigate(e: CustomEvent<{ href: string }>) {
  e.preventDefault();
  route.value = e.detail.href; // router.push(e.detail.href)
}
</script>

<template>
  <div>
    <p>
      Open the <ZLink href="#/docs" @z-navigate="navigate">documentation</ZLink> or the
      <ZLink href="#/pricing" @z-navigate="navigate">pricing</ZLink> page without a page reload.
    </p>
    <p aria-live="polite">Current route: <code>{{ route }}</code></p>
  </div>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZLink, ZStack } from '@zelviora/vue';
</script>

<template>
  <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>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZConfigProvider, ZList, ZListItem, ZStack } from '@zelviora/vue';
import { members } from '../data.ts';

const three = members.slice(0, 3);
</script>

<template>
  <ZStack gap="lg">
    <ZList label="Small, divided" size="sm" divided><ZListItem v-for="m in three" :key="m.key" :heading="m.heading" :description="m.description" /></ZList>
    <ZList label="Medium, bordered" bordered><ZListItem v-for="m in three" :key="m.key" :heading="m.heading" :description="m.description" /></ZList>
    <ZList label="Large, divided and bordered" size="lg" divided bordered><ZListItem v-for="m in three" :key="m.key" :heading="m.heading" :description="m.description" /></ZList>
    <ZConfigProvider density="compact">
      <ZList label="Compact density" divided><ZListItem v-for="m in three" :key="m.key" :heading="m.heading" :description="m.description" /></ZList>
    </ZConfigProvider>
  </ZStack>
</template>

```

### Case: basic

#### Vue
```vue
<script setup lang="ts">
import { ZList, ZListItem } from '@zelviora/vue';
import { members } from '../data.ts';
</script>

<template>
  <ZList label="Members">
    <ZListItem v-for="m in members" :key="m.key" :heading="m.heading" :description="m.description" :href="m.href" />
  </ZList>
</template>

```

### Case: composition

#### Vue
```vue
<script setup lang="ts">
import { ZBadge, ZButton, ZDropdownMenu, ZList, ZListItem, ZMenuItem } from '@zelviora/vue';
import { members } from '../data.ts';

const team = members.slice(0, 3).map((m, i) => ({
  ...m,
  title: i === 2 ? `${m.heading} — responsible for the quarterly reporting of every regional office` : m.heading,
  initials: m.heading.split(' ').pop()!.slice(0, 2).toUpperCase(),
  online: i === 0,
}));
</script>

<template>
  <ZList label="Team" divided bordered>
    <ZListItem v-for="m in team" :key="m.key" :heading="m.title" :description="m.description" :href="m.href">
      <ZBadge slot="prefix" tone="primary">{{ m.initials }}</ZBadge>
      <ZBadge slot="suffix" :tone="m.online ? 'success' : 'neutral'">{{ m.online ? '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>
</template>

```

### Case: load-more

#### Vue
```vue
<script setup lang="ts">
import { computed, ref } from 'vue';
import { ZList, ZListItem } from '@zelviora/vue';
import { makeItems } from '../data.ts';

const all = makeItems(40);
const count = ref(10);
const loading = ref(false);
const shown = computed(() => all.slice(0, count.value));

function more() {
  loading.value = true;
  setTimeout(() => { count.value += 10; loading.value = false; }, 400);
}
</script>

<template>
  <ZList label="Notifications" divided :loading="loading" :load-more="count < all.length" @z-load-more="more">
    <ZListItem v-for="it in shown" :key="it.key" :heading="it.heading" :description="it.description" :href="`#${it.key}`" />
  </ZList>
</template>

```

### Case: rtl

#### Vue
```vue
<script setup lang="ts">
import { ZBadge, ZList, ZListItem } from '@zelviora/vue';
</script>

<template>
  <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>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZList, ZListItem, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZStack gap="lg">
    <ZList label="Loading" loading />
    <ZList label="Empty" empty-text="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>
</template>

```

### Case: virtual

#### Vue
```vue
<script setup lang="ts">
import { ZList } from '@zelviora/vue';
import { makeItems } from '../data.ts';

const items = makeItems(10_000, true);
</script>

<template>
  <ZList label="Notifications" virtual="on" max-height="24rem" divided :items="items" />
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZCard, ZLoadingOverlay, ZStack, ZText } from '@zelviora/vue';

const loading = ref(false);

function reload() {
  loading.value = true;
  setTimeout(() => (loading.value = false), 2000);
}
</script>

<template>
  <ZStack gap="md" align-items="start">
    <ZButton :disabled="loading" @click="reload">Reload</ZButton>
    <ZLoadingOverlay :loading="loading" message="Loading orders">
      <ZCard heading="Orders">
        <ZText>42 open orders, 3 overdue.</ZText>
      </ZCard>
    </ZLoadingOverlay>
  </ZStack>
</template>

```

### Case: fullscreen

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZLoadingOverlay } from '@zelviora/vue';

const loading = ref(false);

function save() {
  loading.value = true;
  setTimeout(() => (loading.value = false), 2000);
}
</script>

<template>
  <ZLoadingOverlay fullscreen :loading="loading" message="Saving the report">
    <ZButton @click="save">Save report</ZButton>
  </ZLoadingOverlay>
</template>

```

### Case: indicator

#### Vue
```vue
<script setup lang="ts">
import { ZCard, ZLoadingOverlay, ZProgress, ZText } from '@zelviora/vue';
</script>

<template>
  <ZLoadingOverlay :loading="true" :delay="0" message="Syncing">
    <ZCard heading="Contacts"><ZText>128 contacts</ZText></ZCard>
    <ZProgress slot="indicator" label="Syncing"></ZProgress>
  </ZLoadingOverlay>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZMapChart } from '@zelviora/vue-chart';
import { demoGeoJson, mapData, mapSeries } from '../data.ts';
</script>

<template>
  <ZMapChart
    heading="Regional Cloud Adoption Choropleth"
    description="Active enterprise deployments across four geographic zones rendered from GeoJSON polygons."
    map-name="zelviora-zones" :geo-json="demoGeoJson" x-key="name" :data="mapData" :series="mapSeries"
  />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/vue';
import {
  ZMapChart,
  type ChartPointSelectDetail,
  type ChartSeriesToggleDetail,
} from '@zelviora/vue-chart';
import { demoGeoJson, mapData, mapSeries } from '../data.ts';

const hidden = ref<string[]>([]);
const selected = ref('Click any chart element to inspect');

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

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

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" gap="sm" align-items="center" wrap>
      <ZButton size="sm" variant="outline" @click="hidden = []">
        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."
      map-name="zelviora-zones" :geo-json="demoGeoJson" x-key="name" :data="mapData" :series="mapSeries"
      selectable
      :hidden-series="hidden"
      @z-series-toggle="onToggle"
      @z-point-select="onSelect"
    />
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZMapChart } from '@zelviora/vue-chart';
import { demoGeoJson, mapData, mapSeries } from '../data.ts';
</script>

<template>
  <ZMapChart
    class="demo-chart-brand"
    description="Active enterprise deployments across four geographic zones rendered from GeoJSON polygons."
    :value-format="{ maximumFractionDigits: 1 }"
    map-name="zelviora-zones" :geo-json="demoGeoJson" x-key="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>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZMapChart } from '@zelviora/vue-chart';
import { demoGeoJson, mapData, mapSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZMapChart
      heading="Loading State (aria-busy)"
      loading
      map-name="zelviora-zones" :geo-json="demoGeoJson" x-key="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."
      show-data-table
      map-name="zelviora-zones" :geo-json="demoGeoJson" x-key="name" :data="mapData" :series="mapSeries"
    />
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZMapChart } from '@zelviora/vue-chart';
import { demoGeoJson, mapData, mapSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZMapChart
      heading="Labeled Choropleth with VisualMap"
      description="Interactive roam with region labels vs clean choropleth without visualMap."
      map-name="zelviora-zones" :geo-json="demoGeoJson" x-key="name" :data="mapData" :series="mapSeries" show-label show-visual-map roam
    />
    <ZMapChart
      heading="Minimal Choropleth"
      description="Interactive roam with region labels vs clean choropleth without visualMap."
      map-name="zelviora-zones" :geo-json="demoGeoJson" x-key="name" :data="mapData" :series="mapSeries" :show-visual-map="false"
    />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZCard, ZMasonry } from '@zelviora/vue';

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

<template>
  <ZMasonry>
    <ZCard v-for="n in notes" :key="n.id" :heading="`Note ${n.id}`">
      <p>{{ n.text }}</p>
    </ZCard>
  </ZMasonry>
</template>

```

### Case: columns

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZCard, ZMasonry, ZStack } from '@zelviora/vue';

const tags = ['design', 'web', 'tokens', 'a11y', 'react', 'vue', 'angular', 'stencil', 'css', 'i18n', 'rtl', 'dark mode'];
const columns = ref(0);
const onLayout = (e: CustomEvent<{ columns: number }>) => (columns.value = e.detail.columns);
</script>

<template>
  <ZStack gap="sm">
    <ZMasonry class="demo-masonry-dense" @z-layout-change="onLayout">
      <ZCard v-for="(t, i) in tags" :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>
</template>

```

### Case: dynamic

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZCard, ZMasonry, ZStack } from '@zelviora/vue';

let next = 4;
const items = ref([1, 2, 3]);
const add = () => items.value.push(next++);
const removeFirst = () => items.value.shift();
</script>

<template>
  <ZStack gap="sm">
    <ZStack orientation="horizontal" gap="sm">
      <ZButton @click="add">Add card</ZButton>
      <ZButton variant="outline" tone="neutral" @click="removeFirst">Remove first</ZButton>
    </ZStack>
    <ZMasonry order="balanced" :columns="3">
      <ZCard v-for="id in items" :key="id" :heading="`Card ${id}`"><p>{{ 'Some content. '.repeat(((id * 5) % 6) + 1) }}</p></ZCard>
    </ZMasonry>
    <small v-if="items.length === 0">No cards.</small>
  </ZStack>
</template>

```

### Case: order

#### Vue
```vue
<script setup lang="ts">
import { ZCard, ZGrid, ZMasonry, ZStack } from '@zelviora/vue';

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

<template>
  <ZGrid columns="1 lg:2" gap="lg">
    <ZStack v-for="order in orders" :key="order" gap="sm">
      <strong>order="{{ order }}"</strong>
      <ZMasonry :order="order" :columns="2">
        <ZCard v-for="n in notes" :key="n.id" :heading="`${n.id}`"><p>{{ n.text }}</p></ZCard>
      </ZMasonry>
    </ZStack>
  </ZGrid>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZMentions } from '@zelviora/vue';

// zSearch (debounced) loads matching people after 300 ms; `filter="none"` because the app filters.
interface User { value: string; label: string; description: string }
const USERS: User[] = [
  { value: 'anna', label: 'Anna', description: 'Design' },
  { value: 'ben', label: 'Ben', description: 'Front-end engineer' },
  { value: 'chloe', label: 'Chloe', description: 'Product manager' },
  { value: 'david', label: 'David', description: 'Back-end engineer' },
  { value: 'grace', label: 'Grace', description: 'QA' },
  { value: 'hannah', label: 'Hannah', description: 'User research' },
  { value: 'kevin', label: 'Kevin', description: 'DevOps' },
  { value: 'laura', label: 'Laura', description: 'Data analyst' },
  { value: 'mark', label: 'Mark', description: 'Team lead' },
  { value: 'tina', label: 'Tina', description: 'Customer support' },
];
const options = ref<User[]>([]);
const loading = ref(false);
let pending = 0;

function onSearch(e: CustomEvent<{ query: string }>) {
  const id = ++pending;
  const q = e.detail.query.toLowerCase();
  loading.value = true;
  setTimeout(() => {
    if (id !== pending) return;
    options.value = USERS.filter((u) => u.value.startsWith(q));
    loading.value = false;
  }, 300);
}
</script>

<template>
  <ZMentions class="demo-narrow" label="Comment (loaded from the server)" filter="none" :options="options" :loading="loading" @z-search="onSearch" />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZMentions, ZStack } from '@zelviora/vue';

// The app owns the text (v-model, model event zInput); selections and the popup are logged. Selecting "Tina" is cancelled.
const USERS = [
  { value: 'anna', label: 'Anna', description: 'Design' },
  { value: 'ben', label: 'Ben', description: 'Front-end engineer' },
  { value: 'chloe', label: 'Chloe', description: 'Product manager' },
  { value: 'david', label: 'David', description: 'Back-end engineer' },
  { value: 'grace', label: 'Grace', description: 'QA' },
  { value: 'hannah', label: 'Hannah', description: 'User research' },
  { value: 'kevin', label: 'Kevin', description: 'DevOps' },
  { value: 'laura', label: 'Laura', description: 'Data analyst' },
  { value: 'mark', label: 'Mark', description: 'Team lead' },
  { value: 'tina', label: 'Tina', description: 'Customer support' },
];
const value = ref('Hi @Chloe ');
const log = ref<string[]>([]);
const add = (line: string) => { log.value = [line, ...log.value].slice(0, 5); };

function onSelect(e: CustomEvent<{ value: string; item: { value: string } }>) {
  if (e.detail.item.value === 'tina') { e.preventDefault(); add('zSelect tina (cancelled)'); return; }
  add(`zSelect ${e.detail.item.value}`);
}
function onOpen(e: CustomEvent<{ open: boolean; reason: string }>) {
  add(`zOpenChange ${e.detail.open} (${e.detail.reason})`);
}
</script>

<template>
  <ZStack class="demo-narrow">
    <ZMentions v-model="value" label="Message" :options="USERS" @z-select="onSelect" @z-open-change="onOpen" />
    <ZStack orientation="horizontal" gap="sm" wrap>
      <ZButton variant="outline" tone="neutral" @click="value = 'Please review this, @Mark '">Set text</ZButton>
      <ZButton variant="outline" tone="neutral" @click="value = ''">Clear</ZButton>
    </ZStack>
    <span>Value: {{ value }}</span>
    <output>{{ log.join(' · ') }}</output>
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZMentions } from '@zelviora/vue';

// Component tokens and the `option-highlighted` part: see the `demo-mentions-brand` rule in README.
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' },
];
</script>

<template>
  <ZMentions class="demo-narrow demo-mentions-brand" label="Comment" :options="USERS" :rows="2" />
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZMentions, ZStack } from '@zelviora/vue';

// Type @ to mention a teammate: arrows move, Enter or Tab inserts, Escape closes.
// v-model binds `value` through the model event `zInput`.
const USERS = [
  { value: 'anna', label: 'Anna', description: 'Design' },
  { value: 'ben', label: 'Ben', description: 'Front-end engineer' },
  { value: 'chloe', label: 'Chloe', description: 'Product manager' },
  { value: 'david', label: 'David', description: 'Back-end engineer' },
  { value: 'grace', label: 'Grace', description: 'QA' },
  { value: 'hannah', label: 'Hannah', description: 'User research' },
  { value: 'kevin', label: 'Kevin', description: 'DevOps' },
  { value: 'laura', label: 'Laura', description: 'Data analyst' },
  { value: 'mark', label: 'Mark', description: 'Team lead' },
  { value: 'tina', label: 'Tina', description: 'Customer support' },
];
const value = ref('');
</script>

<template>
  <ZStack class="demo-narrow">
    <ZMentions v-model="value" label="Comment" placeholder="Type @ to mention a teammate" :options="USERS" />
    <span>Value: {{ value }}</span>
  </ZStack>
</template>

```

### Case: form

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZCard, ZField, ZMentions, ZStack } from '@zelviora/vue';

// A comment box: the text with @label mentions is submitted (FormData); required inside a field; reset clears it.
const USERS = [
  { value: 'anna', label: 'Anna', description: 'Design' },
  { value: 'ben', label: 'Ben', description: 'Front-end engineer' },
  { value: 'chloe', label: 'Chloe', description: 'Product manager' },
  { value: 'david', label: 'David', description: 'Back-end engineer' },
  { value: 'grace', label: 'Grace', description: 'QA' },
  { value: 'hannah', label: 'Hannah', description: 'User research' },
  { value: 'kevin', label: 'Kevin', description: 'DevOps' },
  { value: 'laura', label: 'Laura', description: 'Data analyst' },
  { value: 'mark', label: 'Mark', description: 'Team lead' },
  { value: 'tina', label: 'Tina', description: 'Customer support' },
];
const sent = ref('');

function submit(e: Event) {
  sent.value = JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]);
}
</script>

<template>
  <ZCard heading="Discussion" class="demo-narrow">
    <form @submit.prevent="submit">
      <ZStack>
        <ZField label="Comment" hint="Type @ to mention a teammate" required>
          <ZMentions name="comment" :options="USERS" auto-resize :max-rows="6" required />
        </ZField>
        <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
          <ZButton type="submit">Post comment</ZButton>
          <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
        </ZStack>
        <output v-if="sent">{{ sent }}</output>
      </ZStack>
    </form>
  </ZCard>
</template>

```

### Case: i18n

#### Vue
```vue
<script setup lang="ts">
import { ZGrid, ZMentions } from '@zelviora/vue';

// Typing "@an" finds "Ân" (accents ignored); in RTL the popup follows the caret from the right.
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: 'عمر' },
];
</script>

<template>
  <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>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZGrid, ZMentions } from '@zelviora/vue';

// Empty, filled, loading, no match, disabled, readonly and invalid; a long text scrolls with auto-resize.
const USERS = [
  { value: 'anna', label: 'Anna', description: 'Design' },
  { value: 'ben', label: 'Ben', description: 'Front-end engineer' },
  { value: 'chloe', label: 'Chloe', description: 'Product manager' },
  { value: 'david', label: 'David', description: 'Back-end engineer' },
  { value: 'grace', label: 'Grace', description: 'QA' },
  { value: 'hannah', label: 'Hannah', description: 'User research' },
  { value: 'kevin', label: 'Kevin', description: 'DevOps' },
  { value: 'laura', label: 'Laura', description: 'Data analyst' },
  { value: 'mark', label: 'Mark', description: 'Team lead' },
  { value: 'tina', label: 'Tina', description: 'Customer support' },
];
const LONG = 'Weekly meeting notes:\n1. @Mark sums up the sprint.\n2. @Laura presents the numbers.\n3. @David updates the API.\n4. @Grace reports on testing.\n5. Type @ at the end to see the popup near the bottom.';
</script>

<template>
  <ZGrid columns="1 sm:2" gap="md">
    <ZMentions label="Empty" placeholder="Type @ to mention" :options="USERS" :rows="2" />
    <ZMentions label="With value" value="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" value="Thanks @Ben" :options="USERS" disabled :rows="2" />
    <ZMentions label="Readonly" value="Thanks @Ben" :options="USERS" readonly :rows="2" />
    <ZMentions label="Invalid" value="Thanks @Ben" :options="USERS" invalid :rows="2" />
    <ZMentions label="Long content" :options="USERS" auto-resize :max-rows="4" :value="LONG" />
  </ZGrid>
</template>

```

### Case: triggers

#### Vue
```vue
<script setup lang="ts">
import { ZMentions } from '@zelviora/vue';

// "@" 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 = ['@', '#'];
</script>

<template>
  <ZMentions class="demo-narrow" label="Post" hint="@ people, # topics" :triggers="TRIGGERS" :options="OPTIONS" :rows="3" />
</template>

```

### Case: validation

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZMentions, ZStack } from '@zelviora/vue';

// Required, and a maximum length counted in graphemes (longer input is cut).
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' },
];
</script>

<template>
  <form class="demo-narrow" @submit.prevent>
    <ZStack>
      <ZMentions name="note" label="Note" :options="USERS" required :rows="2" />
      <ZMentions name="short" label="Up to 40 characters" :options="USERS" :max-length="40" :min-length="5" :rows="2" hint="5–40 characters" />
      <ZButton type="submit">Submit</ZButton>
    </ZStack>
  </form>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZGrid, ZMentions } from '@zelviora/vue';

// Outline and filled boxes in every size.
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' },
];
</script>

<template>
  <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>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZMenuItem, ZMenubar, ZMenubarMenu, ZStack } from '@zelviora/vue';

// `value` (open menu) bound with v-model, a disabled menu and a right-to-left menubar.
const value = ref<string | null>(null);
</script>

<template>
  <ZStack gap="md">
    <ZMenubar v-model="value" label="Document">
      <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 align-items="center" gap="md">
      <ZButton variant="outline" tone="neutral" @click="value = '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>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import {
  ZMenuCheckboxItem, ZMenuItem, ZMenuRadioGroup, ZMenuRadioItem, ZMenuSeparator, ZMenuSub, ZMenubar, ZMenubarMenu, ZStack,
} from '@zelviora/vue';

// File / Edit / View with shortcuts, a submenu, checkbox and radio items. One Tab stop; arrows move between menus.
const last = ref('');
const ruler = ref(true);
const zoom = ref('100');
</script>

<template>
  <ZStack gap="sm">
    <ZMenubar label="Editor" @z-select="last = $event.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 v-model="ruler">Ruler</ZMenuCheckboxItem>
        <ZMenuSeparator />
        <ZMenuRadioGroup v-model="zoom">
          <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>
</template>

```

### Case: overflow

#### Vue
```vue
<script setup lang="ts">
import { ZMenuItem, ZMenubar, ZMenubarMenu, ZStack } from '@zelviora/vue';

// Eight menus in a narrow column: `scroll` scrolls the bar, `menu` moves the menus that do not fit into a "…" menu.
const menus = ['File', 'Edit', 'View', 'Insert', 'Format', 'Tools', 'Window', 'Help'];
const modes = ['scroll', 'menu'] as const;
</script>

<template>
  <ZStack orientation="vertical" gap="lg" class="demo-narrow">
    <ZMenubar v-for="overflow in modes" :key="overflow" :label="`Editor (${overflow})`" :overflow="overflow">
      <ZMenubarMenu v-for="m in menus" :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>
</template>

```

### Case: sizes

#### Vue
```vue
<script setup lang="ts">
import { ZMenuItem, ZMenubar, ZMenubarMenu, ZStack } from '@zelviora/vue';

// Sizes sm, md and lg (height and trigger padding follow the control tokens).
const sizes = ['sm', 'md', 'lg'] as const;
</script>

<template>
  <ZStack gap="md">
    <ZMenubar v-for="size in sizes" :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>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { computed, onBeforeUnmount, ref } from 'vue';
import { ZMultiSelect, ZStack } from '@zelviora/vue';

/** 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.
const query = ref('');
const loading = ref(false);
let timer: ReturnType<typeof setTimeout> | undefined;
const shown = computed(() => search(query.value).slice(0, PAGE));

function onSearch(e: CustomEvent<{ query: string }>) {
  const q = e.detail.query;
  clearTimeout(timer);
  loading.value = true;
  timer = setTimeout(() => { query.value = q; loading.value = false; }, 300);
}
onBeforeUnmount(() => clearTimeout(timer));
</script>

<template>
  <ZStack class="demo-narrow">
    <ZMultiSelect label="Delivery address" filter="none" :max-tag-count="4" :loading="loading" :options="shown" @z-search="onSearch" />
  </ZStack>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZMultiSelect, ZSelectGroup, ZSelectOption, ZStack } from '@zelviora/vue';

// `selected` options give the initial tags; groups, a disabled option, clear all; the value keeps the order chosen.
const value = ref<string[]>(['ts', 'css']);

function onChange(e: CustomEvent<{ value: string[] }>) {
  value.value = e.detail.value;
}
</script>

<template>
  <ZStack class="demo-narrow">
    <ZMultiSelect label="Skills" placeholder="Type to search" clearable :max-tag-count="10" @z-change="onChange">
      <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>
</template>

```

### Case: large

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZMultiSelect, ZStack } from '@zelviora/vue';

// 5 000 options as data: the list is virtual (`virtual="auto"` above 200 options); chosen options become tags.
const products = Array.from({ length: 5000 }, (_, i) => ({ value: `sku-${i + 1}`, label: `Product ${i + 1}` }));
const value = ref<string[]>([]);
</script>

<template>
  <ZStack class="demo-narrow">
    <ZMultiSelect v-model="value" label="Products" placeholder="Type a number" :options="products" clearable />
    <span>Value: {{ value.length ? value.join(', ') : 'none' }}</span>
  </ZStack>
</template>

```

### Case: limits

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZMultiSelect, ZSelectOption, ZStack } from '@zelviora/vue';

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.
const sent = ref('');

function submit(e: Event) {
  sent.value = JSON.stringify(new FormData(e.currentTarget as HTMLFormElement).getAll('team'));
}
</script>

<template>
  <form class="demo-narrow" @submit.prevent="submit">
    <ZStack>
      <ZMultiSelect name="team" label="Team members" hint="2 to 3 people" :max-count="3" :min-count="2" :max-tag-count="3">
        <ZSelectOption v-for="p in PEOPLE" :key="p" :value="p.toLowerCase()">{{ p }}</ZSelectOption>
      </ZMultiSelect>
      <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
        <ZButton type="submit">Submit</ZButton>
        <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
      </ZStack>
      <output v-if="sent">{{ sent }}</output>
    </ZStack>
  </form>
</template>

```

### Case: tags

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZMultiSelect, ZSelectOption, ZStack } from '@zelviora/vue';

const TOPICS = [
  'Designing large-scale distributed systems',
  'Test automation',
  'Accessibility',
  'Internationalization',
  'Web performance',
  'Application security',
];

// Responsive tag count in a narrow column ("+N" for the rest), a fixed max-tag-count, long labels cut with an ellipsis.
const value = ref<string[]>(TOPICS.map((_, i) => `t${i}`));
</script>

<template>
  <ZStack class="demo-tight">
    <ZMultiSelect v-model="value" label="Responsive">
      <ZSelectOption v-for="(t, i) in TOPICS" :key="t" :value="`t${i}`">{{ t }}</ZSelectOption>
    </ZMultiSelect>
    <ZMultiSelect v-model="value" label="max-tag-count = 2" :max-tag-count="2">
      <ZSelectOption v-for="(t, i) in TOPICS" :key="t" :value="`t${i}`">{{ t }}</ZSelectOption>
    </ZMultiSelect>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZNavigationMenu, ZNavigationMenuContent, ZNavigationMenuItem, ZNavigationMenuLink, ZStack } from '@zelviora/vue';

// `value` bound with v-model, click-only panels (`disable-hover`) and `current-href` following a route.
const value = ref<string | null>(null);
const page = ref('#navigation-menu-team');

function changeRoute() {
  page.value = page.value.endsWith('team') ? '#navigation-menu-careers' : '#navigation-menu-team';
}
</script>

<template>
  <ZStack gap="md">
    <ZNavigationMenu v-model="value" label="Company" disable-hover :current-href="page">
      <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 align-items="center" gap="md">
      <ZButton variant="outline" tone="neutral" @click="value = 'news'">Open “News”</ZButton>
      <ZButton variant="ghost" tone="neutral" @click="changeRoute">Change route</ZButton>
      <span>{{ `Open panel: ${value ?? 'none'}` }}</span>
    </ZStack>
  </ZStack>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZGrid, ZNavigationMenu, ZNavigationMenuContent, ZNavigationMenuItem, ZNavigationMenuLink, ZStack } from '@zelviora/vue';

// Two panels (one a multi-column mega menu) and a plain link; hover or click opens, Tab walks into the open panel.
const open = ref<string | null>(null);
</script>

<template>
  <ZStack gap="sm">
    <ZNavigationMenu v-model="open" label="Main" current-href="#navigation-menu-pricing">
      <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>
</template>

```

### Case: spa-routing

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZNavigationMenu, ZNavigationMenuContent, ZNavigationMenuItem, ZNavigationMenuLink } from '@zelviora/vue';

const route = ref('#/pricing');
// One zNavigate listener calls the app router (stand-in for `router.push` of Vue Router).
function navigate(e: CustomEvent<{ href: string }>) {
  e.preventDefault();
  route.value = e.detail.href; // router.push(e.detail.href)
}
// Stand-in for `<RouterLink>`: an `<a href>` that routes on a plain click.
function appLink(e: MouseEvent) {
  if (e.ctrlKey || e.metaKey || e.shiftKey || e.button !== 0) return;
  e.preventDefault();
  route.value = (e.currentTarget as HTMLAnchorElement).getAttribute('href')!;
}
</script>

<template>
  <div>
    <ZNavigationMenu label="Main" :current-href="route" @z-navigate="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" @click="appLink">Pricing</a></ZNavigationMenuItem>
      <ZNavigationMenuItem value="docs"><a href="#/docs" @click="appLink">Docs</a></ZNavigationMenuItem>
    </ZNavigationMenu>
    <p aria-live="polite">Current route: <code>{{ route }}</code></p>
  </div>
</template>

```

### Case: vertical

#### Vue
```vue
<script setup lang="ts">
import { ZNavigationMenu, ZNavigationMenuContent, ZNavigationMenuItem, ZNavigationMenuLink, ZStack } from '@zelviora/vue';

// Vertical orientation (panels open at the inline end; ArrowUp / ArrowDown between items) and right-to-left.
</script>

<template>
  <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>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZNumberInput, ZStack } from '@zelviora/vue';

// v-model holds a number (or null when empty); the change event reports committed values.
const value = ref<number | null>(2);
const committed = ref<number | null>(2);

function onChange(e: CustomEvent<{ value: number | null }>) {
  committed.value = e.detail.value;
}
</script>

<template>
  <ZStack gap="sm" class="demo-narrow">
    <ZNumberInput v-model="value" label="Tickets" :min="0" :max="10" @z-change="onChange" />
    <small>Value: {{ value ?? '—' }} · Last change: {{ committed ?? '—' }}</small>
  </ZStack>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ZNumberInput, ZStack } from '@zelviora/vue';

// Quantity with min/max and a unit in the suffix slot; arrows, PageUp/PageDown, Home/End and the buttons step the value.
</script>

<template>
  <ZStack class="demo-narrow">
    <ZNumberInput label="Quantity" name="qty" :min="1" :max="99" :value="1" hint="1 to 99" />
    <ZNumberInput label="Weight" name="weight" :min="0" :step="0.1" :value="0.3">
      <span slot="suffix">kg</span>
    </ZNumberInput>
  </ZStack>
</template>

```

### Case: error

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZNumberInput, ZStack } from '@zelviora/vue';

// Validation after blur or submit: required, range (clamp-behavior none keeps the typed value), text that does not parse.
</script>

<template>
  <form class="demo-narrow" @submit.prevent>
    <ZStack>
      <ZNumberInput label="Guests" name="guests" required hint="Type a number, clear it and leave the field" />
      <ZNumberInput label="Deposit" name="deposit" :min="1000" clamp-behavior="none" :value="500" hint="At least 1,000" />
      <ZNumberInput label="Rooms" name="rooms" invalid :value="3" hint="Forced error display" />
      <ZButton type="submit">Book</ZButton>
    </ZStack>
  </form>
</template>

```

### Case: form

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZNumberInput, ZStack } from '@zelviora/vue';

// The form always receives the canonical string ("1234.5"), whatever the display locale.
const percent: Intl.NumberFormatOptions = { style: 'percent' };
const sent = ref('');

function submit(e: Event) {
  sent.value = JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]);
}
</script>

<template>
  <form class="demo-narrow" @submit.prevent="submit">
    <ZStack>
      <ZNumberInput label="Amount" name="amount" locale="de-DE" :step="0.1" :value="1234.5" />
      <ZNumberInput label="Rate" name="rate" :format-options="percent" :value="0.5" />
      <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
        <ZButton type="submit">Submit</ZButton>
        <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
      </ZStack>
      <output v-if="sent">{{ sent }}</output>
    </ZStack>
  </form>
</template>

```

### Case: formats

#### Vue
```vue
<script setup lang="ts">
import { ZGrid, ZNumberInput } from '@zelviora/vue';

// Intl formats: currency in de-DE and en-US, percent (the value is a ratio: 0.15 shows 15%), unit. Focus shows plain digits.
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 };
</script>

<template>
  <ZGrid columns="1 sm:2">
    <ZNumberInput label="Price (de-DE)" locale="de-DE" :format-options="eur" :min="0" :step="0.01" :value="1250" />
    <ZNumberInput label="Price (en-US)" locale="en-US" :format-options="usd" :min="0" :step="0.01" :value="1234.5" />
    <ZNumberInput label="Discount" :format-options="percent" :min="0" :max="1" :value="0.15" />
    <ZNumberInput label="Distance" :format-options="km" :min="0" :step="0.001" :value="42.195" />
  </ZGrid>
</template>

```

### Case: i18n

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZConfigProvider, ZNumberInput, ZStack } from '@zelviora/vue';

// With locale `vi` the number uses "." for thousands and "," for decimals; the required error is Vietnamese.
const vnd: Intl.NumberFormatOptions = { style: 'currency', currency: 'VND' };
</script>

<template>
  <ZConfigProvider locale="vi">
    <form class="demo-narrow" @submit.prevent>
      <ZStack>
        <ZNumberInput label="Giá" :format-options="vnd" :min="0" :step="1000" :value="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>
</template>

```

### Case: layout

#### Vue
```vue
<script setup lang="ts">
import { ZNumberInput, ZStack } from '@zelviora/vue';

// Stepper button layouts: stacked (default), horizontal, vertical, and blank.
</script>

<template>
  <ZStack class="demo-narrow">
    <ZNumberInput label="Stacked (Default)" button-layout="stacked" :value="5" hint="Up and down buttons on the right" />
    <ZNumberInput label="Horizontal" button-layout="horizontal" :value="10" hint="Decrement on left, increment on right" />
    <ZNumberInput label="Vertical" button-layout="vertical" :value="3" hint="Increment on top, decrement on bottom" />
    <ZNumberInput label="Blank" button-layout="blank" :value="25" hint="Without stepper buttons" />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZOtpInput, ZStack } from '@zelviora/vue';

// Six digit cells, one Tab stop; paste or SMS autofill spreads over the cells.
const code = ref('');

function onComplete(e: CustomEvent<{ value: string }>) {
  code.value = e.detail.value;
}
</script>

<template>
  <ZStack gap="sm">
    <ZOtpInput label="Verification code" name="code" hint="Sent to your phone" @z-complete="onComplete" />
    <small>Completed: {{ code || '—' }}</small>
  </ZStack>
</template>

```

### Case: error

#### Vue
```vue
<script setup lang="ts">
import { ZOtpInput } from '@zelviora/vue';

// A wrong code reported by the server through setCustomValidity (the right code here is 123456).
type OtpElement = HTMLElement & { setCustomValidity(m: string): Promise<void>; reportValidity(): Promise<boolean> };

function onInput(e: CustomEvent<{ value: string }>) {
  void (e.target as OtpElement).setCustomValidity('');
}

async function onComplete(e: CustomEvent<{ value: string }>) {
  const el = e.target as OtpElement;
  await el.setCustomValidity(e.detail.value === '123456' ? '' : 'Wrong code, check the latest SMS.');
  await el.reportValidity();
}
</script>

<template>
  <ZOtpInput label="Verification code" hint="Try 111111, then 123456" @z-input="onInput" @z-complete="onComplete" />
</template>

```

### Case: form

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZOtpInput, ZStack } from '@zelviora/vue';

// autoSubmit: the form is submitted as soon as every cell is filled.
const sent = ref('');

function submit(e: Event) {
  sent.value = JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]);
}
</script>

<template>
  <form @submit.prevent="submit">
    <ZStack gap="sm">
      <ZOtpInput label="Code" name="code" :length="4" auto-submit required />
      <output v-if="sent">{{ sent }}</output>
    </ZStack>
  </form>
</template>

```

### Case: mask

#### Vue
```vue
<script setup lang="ts">
import { ZOtpInput, ZStack } from '@zelviora/vue';

// Masked PIN of four digits in the three sizes.
</script>

<template>
  <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>
</template>

```

### Case: separator

#### Vue
```vue
<script setup lang="ts">
import { ZOtpInput, ZStack } from '@zelviora/vue';

// A separator after cell 3; letters and digits in upper case for a licence key.
</script>

<template>
  <ZStack>
    <ZOtpInput label="Code" :separator-after="3" />
    <ZOtpInput label="Licence key" :length="8" :separator-after="4" type="alphanumeric" uppercase />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZPagination, ZStack } from '@zelviora/vue';

const page = ref(3);
const pageSize = ref(20);
</script>

<template>
  <ZStack gap="sm">
    <ZPagination
      v-model="page"
      :total="12500"
      :page-size="pageSize"
      :page-size-options="[10, 20, 50, 100]"
      show-quick-jumper
      @z-page-size-change="pageSize = $event.detail.pageSize"
    />
    <p>Page {{ page }}, {{ pageSize }} per page</p>
  </ZStack>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ZPagination } from '@zelviora/vue';
</script>

<template>
  <ZPagination :total="230" show-first-last show-summary />
</template>

```

### Case: links

#### Vue
```vue
<script setup lang="ts">
import { ZPagination } from '@zelviora/vue';

const hrefOf = (page: number) => `#pagination-page-${page}`;
</script>

<template>
  <ZPagination :total="95" :get-page-href="hrefOf" />
</template>

```

### Case: simple

#### Vue
```vue
<script setup lang="ts">
import { ZPagination, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZStack gap="sm">
    <ZPagination :total="230" simple />
    <ZPagination :total="0" simple />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZParallelChart } from '@zelviora/vue-chart';
import { parallelAxes, parallelData, parallelSeries } from '../data.ts';
</script>

<template>
  <ZParallelChart
    heading="AI Model Benchmark Trade-offs"
    description="Comparing accuracy, latency, memory footprint, and throughput across four model checkpoints."
    x-key="model" :axes="parallelAxes" :data="parallelData" :series="parallelSeries"
  />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/vue';
import {
  ZParallelChart,
  type ChartPointSelectDetail,
  type ChartSeriesToggleDetail,
} from '@zelviora/vue-chart';
import { parallelAxes, parallelData, parallelSeries } from '../data.ts';

const hidden = ref<string[]>([]);
const selected = ref('Click any chart element to inspect');

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

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

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" gap="sm" align-items="center" wrap>
      <ZButton size="sm" variant="outline" @click="hidden = []">
        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."
      x-key="model" :axes="parallelAxes" :data="parallelData" :series="parallelSeries"
      selectable
      :hidden-series="hidden"
      @z-series-toggle="onToggle"
      @z-point-select="onSelect"
    />
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZParallelChart } from '@zelviora/vue-chart';
import { parallelAxes, parallelData, parallelSeries } from '../data.ts';
</script>

<template>
  <ZParallelChart
    class="demo-chart-brand"
    description="Comparing accuracy, latency, memory footprint, and throughput across four model checkpoints."
    :value-format="{ maximumFractionDigits: 1 }"
    x-key="model" :axes="parallelAxes" :data="parallelData" :series="parallelSeries" smooth :line-opacity="0.85" renderer="canvas"
  >
    <span slot="heading">AI Model Benchmark Trade-offs — Custom Theme Tokens &amp; Canvas</span>
  </ZParallelChart>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZParallelChart } from '@zelviora/vue-chart';
import { parallelAxes, parallelData, parallelSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZParallelChart
      heading="Loading State (aria-busy)"
      loading
      x-key="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."
      show-data-table
      x-key="model" :axes="parallelAxes" :data="parallelData" :series="parallelSeries"
    />
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZParallelChart } from '@zelviora/vue-chart';
import { parallelAxes, parallelData, parallelSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZParallelChart
      heading="Smooth Coordinate Splines"
      description="Smooth parallel coordinate splines vs crisp polylines with subtle opacity."
      x-key="model" :axes="parallelAxes" :data="parallelData" :series="parallelSeries" smooth :line-opacity="0.75"
    />
    <ZParallelChart
      heading="Crisp Polylines"
      description="Smooth parallel coordinate splines vs crisp polylines with subtle opacity."
      x-key="model" :axes="parallelAxes" :data="parallelData" :series="parallelSeries" :smooth="false" :line-opacity="0.4"
    />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZPasswordInput } from '@zelviora/vue';
</script>

<template>
  <div class="demo-narrow">
    <ZPasswordInput label="Password" name="password" hint="Caps Lock is detected while you type" />
  </div>
</template>

```

### Case: form

#### Vue
```vue
<script setup lang="ts">
import { computed, ref } from 'vue';
import { ZButton, ZField, ZInput, ZPasswordInput, ZStack } from '@zelviora/vue';

const password = ref('');
const confirm = ref('');
const result = ref('');
const mismatch = computed(() => (confirm.value !== '' && confirm.value !== password.value ? 'The passwords do not match.' : null));

function onSubmit(e: Event) {
  const data = new FormData(e.currentTarget as HTMLFormElement);
  result.value = mismatch.value ? '' : `Submitted for ${data.get('email')} (${String(data.get('password')).length} characters)`;
}
function onReset() {
  password.value = '';
  confirm.value = '';
  result.value = '';
}
</script>

<template>
  <form class="demo-narrow" @submit.prevent="onSubmit">
    <ZStack gap="md">
      <ZInput label="Email" name="email" type="email" autocomplete="username" required />
      <ZPasswordInput v-model="password" label="Password" name="password" autocomplete="new-password" :min-length="8" required />
      <ZField label="Confirm password" :error="mismatch">
        <ZPasswordInput v-model="confirm" name="confirm" autocomplete="new-password" required />
      </ZField>
      <ZStack orientation="horizontal" gap="sm">
        <ZButton type="submit">Create account</ZButton>
        <ZButton type="reset" variant="ghost" tone="neutral" @click="onReset">Reset</ZButton>
      </ZStack>
      <small v-if="result">{{ result }}</small>
    </ZStack>
  </form>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZGrid, ZPasswordInput } from '@zelviora/vue';
</script>

<template>
  <ZGrid columns="1 md:2" gap="md">
    <ZPasswordInput label="Visible" value="correct horse" visible />
    <ZPasswordInput label="Filled, small" variant="filled" size="sm" value="secret" />
    <ZPasswordInput label="Disabled" value="secret" disabled />
    <ZPasswordInput label="Too short" value="abc" :min-length="8" invalid hint="At least 8 characters" />
    <ZPasswordInput label="Without toggle" value="secret" hide-toggle />
    <ZPasswordInput label="Large" size="lg" placeholder="Enter your password" />
  </ZGrid>
</template>

```

### Case: strength

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZPasswordInput } from '@zelviora/vue';

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

const value = ref('');
</script>

<template>
  <div class="demo-narrow">
    <ZPasswordInput v-model="value" label="New password" autocomplete="new-password" :strength="value ? score(value) : undefined" />
  </div>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZPictorialBarChart } from '@zelviora/vue-chart';
import { rackData, rackSeries } from '../data.ts';
</script>

<template>
  <ZPictorialBarChart
    heading="Data Center Rack Capacity by Zone"
    description="Provisioned vs active server racks visualized with symbolic pictorial bars."
    x-key="zone" :data="rackData" :series="rackSeries"
  />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/vue';
import {
  ZPictorialBarChart,
  type ChartPointSelectDetail,
  type ChartSeriesToggleDetail,
} from '@zelviora/vue-chart';
import { rackData, rackSeries } from '../data.ts';

const hidden = ref<string[]>([]);
const selected = ref('Click any chart element to inspect');

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

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

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" gap="sm" align-items="center" wrap>
      <ZButton size="sm" variant="outline" @click="hidden = []">
        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."
      x-key="zone" :data="rackData" :series="rackSeries"
      selectable
      :hidden-series="hidden"
      @z-series-toggle="onToggle"
      @z-point-select="onSelect"
    />
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZPictorialBarChart } from '@zelviora/vue-chart';
import { rackData, rackSeries } from '../data.ts';
</script>

<template>
  <ZPictorialBarChart
    class="demo-chart-brand"
    description="Provisioned vs active server racks visualized with symbolic pictorial bars."
    :value-format="{ maximumFractionDigits: 1 }"
    x-key="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>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZPictorialBarChart } from '@zelviora/vue-chart';
import { rackData, rackSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZPictorialBarChart
      heading="Loading State (aria-busy)"
      loading
      x-key="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."
      show-data-table
      x-key="zone" :data="rackData" :series="rackSeries"
    />
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZPictorialBarChart } from '@zelviora/vue-chart';
import { rackData, rackSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZPictorialBarChart
      heading="Repeated Diamond Glyphs"
      description="Repeated clipped diamond glyphs vs horizontal rounded pictorial bars."
      x-key="zone" :data="rackData" :series="rackSeries" symbol="diamond" symbol-repeat symbol-clip :symbol-size="18"
    />
    <ZPictorialBarChart
      heading="Horizontal Pictorial Bars"
      description="Repeated clipped diamond glyphs vs horizontal rounded pictorial bars."
      x-key="zone" :data="rackData" :series="rackSeries" orientation="horizontal" symbol="roundRect"
    />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZPieChart } from '@zelviora/vue-chart';
import { channelData, channelSeries } from '../data.ts';
</script>

<template>
  <ZPieChart
    heading="Traffic Acquisition Share by Channel"
    description="Organic search leads acquisition followed by Direct, Referral, and Social channels."
    x-key="channel" :data="channelData" :series="channelSeries"
  />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/vue';
import {
  ZPieChart,
  type ChartPointSelectDetail,
  type ChartSeriesToggleDetail,
} from '@zelviora/vue-chart';
import { channelData, channelSeries } from '../data.ts';

const hidden = ref<string[]>([]);
const selected = ref('Click any chart element to inspect');

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

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

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" gap="sm" align-items="center" wrap>
      <ZButton size="sm" variant="outline" @click="hidden = []">
        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."
      x-key="channel" :data="channelData" :series="channelSeries"
      selectable
      :hidden-series="hidden"
      @z-series-toggle="onToggle"
      @z-point-select="onSelect"
    />
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZPieChart } from '@zelviora/vue-chart';
import { channelData, channelSeries } from '../data.ts';
</script>

<template>
  <ZPieChart
    class="demo-chart-brand"
    description="Organic search leads acquisition followed by Direct, Referral, and Social channels."
    :value-format="{ maximumFractionDigits: 1 }"
    x-key="channel" :data="channelData" :series="channelSeries" outer-radius="68%" :pad-angle="4" renderer="canvas"
  >
    <span slot="heading">Traffic Acquisition Share by Channel — Custom Theme Tokens &amp; Canvas</span>
  </ZPieChart>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZPieChart } from '@zelviora/vue-chart';
import { channelData, channelSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZPieChart
      heading="Loading State (aria-busy)"
      loading
      x-key="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."
      show-data-table
      x-key="channel" :data="channelData" :series="channelSeries"
    />
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZPieChart } from '@zelviora/vue-chart';
import { channelData, channelSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZPieChart
      heading="Nightingale Radius Rose"
      description="Nightingale radius rose chart with slice padding vs equal-angle area rose chart."
      x-key="channel" :data="channelData" :series="channelSeries" rose-type="radius" :pad-angle="2"
    />
    <ZPieChart
      heading="Equal-Angle Area Rose"
      description="Nightingale radius rose chart with slice padding vs equal-angle area rose chart."
      x-key="channel" :data="channelData" :series="channelSeries" rose-type="area" :start-angle="180"
    />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZPopconfirm, ZStack } from '@zelviora/vue';

// Keeps the confirmation open while a (fake) request runs: preventDefault() on confirm, then close from the ref.
const open = ref(false);
const loading = ref(false);

function onOpenChange(e: CustomEvent<{ open: boolean; reason: string }>) {
  open.value = e.detail.open;
}

function onConfirm(e: CustomEvent) {
  e.preventDefault();
  loading.value = true;
  setTimeout(() => {
    loading.value = false;
    open.value = false;
  }, 1000);
}
</script>

<template>
  <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
    <ZPopconfirm
      heading="Archive this project?"
      tone="warning"
      action-label="Archive"
      :open="open"
      :action-loading="loading"
      @z-open-change="onOpenChange"
      @z-confirm="onConfirm"
      @z-cancel="loading = false"
    >
      <ZButton slot="trigger" variant="outline" tone="warning">Archive</ZButton>
    </ZPopconfirm>
    <ZPopconfirm heading="Send the invitation again?" tone="info" placement="bottom" action-label="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>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZPopconfirm } from '@zelviora/vue';
</script>

<template>
  <ZPopconfirm heading="Delete this row?" description="You can restore it from the trash for 30 days." tone="destructive" action-label="Delete">
    <ZButton slot="trigger" variant="outline" tone="destructive">Delete</ZButton>
  </ZPopconfirm>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZPopover, ZStack } from '@zelviora/vue';
</script>

<template>
  <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>
</template>

```

### Case: placement

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZPopover, ZStack } from '@zelviora/vue';

const placements = ['top', 'right', 'bottom', 'left'] as const;
</script>

<template>
  <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
    <ZPopover
      v-for="placement in placements"
      :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>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZProgress } from '@zelviora/vue';
</script>

<template>
  <div class="demo-narrow">
    <ZProgress label="Uploading report.pdf" :value="40" show-value />
  </div>
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZProgress, ZStack, ZText } from '@zelviora/vue';

const files = ref(0);
const done = ref(false);
function next() {
  files.value = Math.min(10, files.value + 1);
}
function restart() {
  files.value = 0;
  done.value = false;
}
</script>

<template>
  <ZStack gap="md" class="demo-narrow">
    <ZProgress
      label="Importing files"
      :value="files"
      :max="10"
      :value-text="`${files} of 10 files`"
      show-value
      announce
      @z-complete="done = true"
    />
    <ZStack orientation="horizontal" align-items="center" gap="sm">
      <ZButton size="sm" :disabled="files >= 10" @click="next">Import one</ZButton>
      <ZButton size="sm" variant="ghost" tone="neutral" @click="restart">Restart</ZButton>
      <ZText variant="muted" size="sm">{{ done ? 'zComplete received' : 'Running' }}</ZText>
    </ZStack>
  </ZStack>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZProgress, ZStack } from '@zelviora/vue';

const tones = ['primary', 'success', 'warning', 'info', 'neutral'] as const;
</script>

<template>
  <ZStack gap="md" class="demo-narrow">
    <ZProgress label="Not started" :value="0" show-value />
    <ZProgress label="Half way" :value="50" show-value />
    <ZProgress label="Done" :value="100" show-value />
    <ZProgress label="Preparing the export (indeterminate)" />
    <ZProgress label="Upload failed" :value="64" tone="destructive" value-text="Failed at 64%" show-value />
    <ZProgress v-for="tone in tones" :key="tone" :label="`Tone ${tone}`" :tone="tone" :value="30" />
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZGrid, ZProgress, ZStack } from '@zelviora/vue';

const sizes = ['sm', 'md', 'lg'] as const;
</script>

<template>
  <ZGrid columns="1 md:2" gap="lg">
    <ZStack gap="md">
      <ZProgress v-for="size in sizes" :key="size" :label="`Linear ${size}`" :size="size" :value="60" show-value />
      <ZProgress kind="meter" label="Disk usage" :value="82" :low="60" :high="80" :optimum="20" value-text="82 GB of 100 GB" show-value />
    </ZStack>
    <ZStack orientation="horizontal" align-items="center" gap="lg" wrap>
      <ZProgress v-for="size in sizes" :key="size" shape="circle" :label="`Circle ${size}`" :size="size" :value="75" show-value />
      <ZProgress shape="circle" kind="meter" label="Battery" :value="15" :low="20" :high="80" :optimum="90" show-value />
    </ZStack>
  </ZGrid>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZQrCode } from '@zelviora/vue';
</script>

<template>
  <ZQrCode value="https://example.com/o/123" label="QR code to open order 123" />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref, watch } from 'vue';
import { ZInput, ZQrCode, ZStack } from '@zelviora/vue';

const value = ref('https://example.com');
const error = ref('');
watch(value, () => (error.value = ''));
const onError = (e: CustomEvent<{ error: Error }>) => (error.value = e.detail.error.message);
</script>

<template>
  <ZStack gap="sm" class="demo-narrow">
    <ZInput v-model="value" label="Text to encode" />
    <ZQrCode :value="value" :label="`QR code for ${value}`" error-correction="H" @z-error="onError" />
    <small>{{ error || `${value.length} characters` }}</small>
  </ZStack>
</template>

```

### Case: custom

#### Vue
```vue
<script setup lang="ts">
import { ZCard, ZQrCode, ZStack, ZText } from '@zelviora/vue';
</script>

<template>
  <ZCard heading="Pay 250 000 ₫" description="Scan with your banking app" class="demo-narrow">
    <ZStack align-items="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" stroke-width="2.5" stroke-linecap="round" />
        </svg>
      </ZQrCode>
      <ZText size="sm">pay.example.com/i/INV-0042</ZText>
    </ZStack>
  </ZCard>
</template>

```

### Case: levels

#### Vue
```vue
<script setup lang="ts">
import { ZQrCode, ZStack } from '@zelviora/vue';

const levels = ['L', 'M', 'Q', 'H'] as const;
</script>

<template>
  <ZStack orientation="horizontal" wrap gap="lg">
    <ZStack v-for="level in levels" :key="level" gap="xs" align-items="center">
      <ZQrCode value="https://example.com/o/123" :error-correction="level" :label="`QR code, error correction ${level}`" />
      <span>{{ level }}</span>
    </ZStack>
  </ZStack>
</template>

```

### Case: sizes

#### Vue
```vue
<script setup lang="ts">
import { ZQrCode, ZStack } from '@zelviora/vue';

const sizes = ['sm', 'md', 'lg'] as const;
</script>

<template>
  <ZStack orientation="horizontal" wrap align-items="end" gap="lg">
    <ZQrCode v-for="size in sizes" :key="size" :size="size" value="https://example.com" :label="`QR code, size ${size}`" />
  </ZStack>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZQrCode, ZStack } from '@zelviora/vue';

const token = ref(1);
const status = ref<'expired' | 'loading' | 'active'>('expired');
const refresh = () => {
  status.value = 'loading';
  // A real app requests a new login token here.
  queueMicrotask(() => {
    token.value += 1;
    status.value = 'active';
  });
};
</script>

<template>
  <ZStack orientation="horizontal" wrap gap="lg">
    <ZQrCode :value="`login-token-${token}`" label="Login QR code" :status="status" @z-refresh="refresh" />
    <ZQrCode value="login-token" label="Login QR code (loading)" status="loading" />
    <ZQrCode value="login-token" label="Login QR code (scanned)" status="scanned" />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZRadarChart } from '@zelviora/vue-chart';
import { radarIndicators, radarData, radarSeries } from '../data.ts';
</script>

<template>
  <ZRadarChart
    heading="Platform Readiness Assessment"
    description="Multi-dimensional capability comparison between Release v1 and Release v2."
    x-key="metric" :indicators="radarIndicators" :data="radarData" :series="radarSeries"
  />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/vue';
import {
  ZRadarChart,
  type ChartPointSelectDetail,
  type ChartSeriesToggleDetail,
} from '@zelviora/vue-chart';
import { radarIndicators, radarData, radarSeries } from '../data.ts';

const hidden = ref<string[]>([]);
const selected = ref('Click any chart element to inspect');

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

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

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" gap="sm" align-items="center" wrap>
      <ZButton size="sm" variant="outline" @click="hidden = []">
        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."
      x-key="metric" :indicators="radarIndicators" :data="radarData" :series="radarSeries"
      selectable
      :hidden-series="hidden"
      @z-series-toggle="onToggle"
      @z-point-select="onSelect"
    />
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZRadarChart } from '@zelviora/vue-chart';
import { radarIndicators, radarData, radarSeries } from '../data.ts';
</script>

<template>
  <ZRadarChart
    class="demo-chart-brand"
    description="Multi-dimensional capability comparison between Release v1 and Release v2."
    :value-format="{ maximumFractionDigits: 1 }"
    x-key="metric" :indicators="radarIndicators" :data="radarData" :series="radarSeries" radar-shape="circle" :area-opacity="0.4" renderer="canvas"
  >
    <span slot="heading">Platform Readiness Assessment — Custom Theme Tokens &amp; Canvas</span>
  </ZRadarChart>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZRadarChart } from '@zelviora/vue-chart';
import { radarIndicators, radarData, radarSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZRadarChart
      heading="Loading State (aria-busy)"
      loading
      x-key="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."
      show-data-table
      x-key="metric" :indicators="radarIndicators" :data="radarData" :series="radarSeries"
    />
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZRadarChart } from '@zelviora/vue-chart';
import { radarIndicators, radarData, radarSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZRadarChart
      heading="Circular Radar Grid"
      description="Circular radar web with filled area vs polygon radar outline."
      x-key="metric" :indicators="radarIndicators" :data="radarData" :series="radarSeries" radar-shape="circle" :area-opacity="0.32"
    />
    <ZRadarChart
      heading="Polygon Radar Grid"
      description="Circular radar web with filled area vs polygon radar outline."
      x-key="metric" :indicators="radarIndicators" :data="radarData" :series="radarSeries" radar-shape="polygon" :area-opacity="0.1"
    />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZRadioGroup, ZRadioGroupItem, ZStack } from '@zelviora/vue';

const value = ref('standard');
</script>

<template>
  <ZStack>
    <ZRadioGroup v-model="value" name="shipping" label="Shipping method">
      <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>
</template>

```

### Case: horizontal

#### Vue
```vue
<script setup lang="ts">
import { ZRadioGroup, ZRadioGroupItem } from '@zelviora/vue';
</script>

<template>
  <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>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { computed, ref } from 'vue';
import { ZGrid, ZNumberInput, ZRangeSlider, ZStack } from '@zelviora/vue';

// v-model holds the [start, end] array; two number-inputs edit each end.
const range = ref<[number, number]>([20, 60]);
const from = computed({ get: () => range.value[0], set: (v: number | null) => { range.value = [v ?? 0, range.value[1]]; } });
const to = computed({ get: () => range.value[1], set: (v: number | null) => { range.value = [range.value[0], v ?? 100]; } });
</script>

<template>
  <ZStack class="demo-narrow">
    <ZRangeSlider v-model="range" label="Temperature" />
    <ZGrid columns="2">
      <ZNumberInput v-model="from" label="From" :min="0" :max="range[1]" />
      <ZNumberInput v-model="to" label="To" :min="range[0]" :max="100" />
    </ZGrid>
  </ZStack>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ZRangeSlider, ZStack } from '@zelviora/vue';

// Two thumbs that never cross; each thumb is a Tab stop named after the group label.
</script>

<template>
  <ZStack class="demo-narrow">
    <ZRangeSlider label="Age" :start="20" :end="80" hint="Drag either thumb" />
    <ZRangeSlider label="Hours" :min="0" :max="24" :start="9" :end="17" show-value="always" />
  </ZStack>
</template>

```

### Case: form

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZRangeSlider, ZStack } from '@zelviora/vue';

// Two FormData entries under the same name, start then end (getAll('price')).
const sent = ref('');

function submit(e: Event) {
  sent.value = JSON.stringify(new FormData(e.currentTarget as HTMLFormElement).getAll('price'));
}
</script>

<template>
  <form class="demo-narrow" @submit.prevent="submit">
    <ZStack>
      <ZRangeSlider label="Price" name="price" :min="0" :max="500" :step="10" :start="100" :end="300" />
      <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
        <ZButton type="submit">Filter</ZButton>
        <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
      </ZStack>
      <output v-if="sent">{{ sent }}</output>
    </ZStack>
  </form>
</template>

```

### Case: i18n

#### Vue
```vue
<script setup lang="ts">
import { ZRangeSlider } from '@zelviora/vue';

// `lang="vi"`: values formatted as VND; minDistance keeps the thumbs at least 100.000 ₫ apart.
const vnd = (v: number, locale: string) => new Intl.NumberFormat(locale, { style: 'currency', currency: 'VND' }).format(v);
</script>

<template>
  <div class="demo-narrow" lang="vi">
    <ZRangeSlider label="Khoảng giá" :min="0" :max="1000000" :step="10000" :min-distance="100000" :start="200000" :end="800000" :format-value="vnd" />
  </div>
</template>

```

### Case: min-distance

#### Vue
```vue
<script setup lang="ts">
import { ZRangeSlider } from '@zelviora/vue';

// minDistance keeps the thumbs at least $100 apart; values formatted as US dollars.
const usd = (v: number, locale: string) => new Intl.NumberFormat(locale, { style: 'currency', currency: 'USD', maximumFractionDigits: 0 }).format(v);
</script>

<template>
  <div class="demo-narrow">
    <ZRangeSlider label="Price range" :min="0" :max="1000" :step="10" :min-distance="100" :start="200" :end="800" :format-value="usd" />
  </div>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZRating, ZStack } from '@zelviora/vue';

// The app owns `value` (v-model): buttons set it from code (no event); hover preview and user changes are logged.
const value = ref(2);
const log = ref<string[]>([]);
const add = (line: string) => { log.value = [line, ...log.value].slice(0, 5); };

function onChange(e: CustomEvent<{ value: number }>) {
  add(`zChange ${e.detail.value}`);
}
function onHover(e: CustomEvent<{ value: number | null }>) {
  add(`zHoverChange ${e.detail.value}`);
}
</script>

<template>
  <ZStack class="demo-narrow">
    <ZRating v-model="value" label="Service quality" @z-change="onChange" @z-hover-change="onHover" />
    <ZStack orientation="horizontal" gap="sm" wrap>
      <ZButton variant="outline" tone="neutral" @click="value = 5">Set 5</ZButton>
      <ZButton variant="outline" tone="neutral" @click="value = 0">Clear</ZButton>
    </ZStack>
    <span>Value: {{ value }}</span>
    <output>{{ log.join(' · ') }}</output>
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZRating, ZStack } from '@zelviora/vue';
import { registerIcons } from '@zelviora/icons';

// A heart from the icon registry (`icon`) and component tokens: see the `demo-rating-heart` rule in README.
// 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>',
  },
});
</script>

<template>
  <ZStack>
    <ZRating class="demo-rating-heart" label="Favorite" icon="app-heart" :value="4" />
    <ZRating class="demo-rating-heart" label="Favorite (half)" icon="app-heart" allow-half :value="2.5" />
  </ZStack>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZRating, ZStack } from '@zelviora/vue';

// Five stars: click or use the arrow keys; choosing the selected star again (or Delete) clears the rating.
// v-model binds `value` (number) through the model event `zChange`.
const value = ref(0);
</script>

<template>
  <ZStack class="demo-narrow">
    <ZRating v-model="value" label="Product rating" />
    <span>Value: {{ value }}</span>
  </ZStack>
</template>

```

### Case: display

#### Vue
```vue
<script setup lang="ts">
import { ZRating, ZStack } from '@zelviora/vue';

// `readonly` shows a score as one image ("4.3 out of 5 stars"), drawn to the nearest half star; not focusable.
</script>

<template>
  <ZStack>
    <ZRating label="Average score" readonly :value="4.3" />
    <ZRating label="No ratings yet" readonly :value="0" />
  </ZStack>
</template>

```

### Case: form

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZCard, ZField, ZRating, ZStack, ZTextarea } from '@zelviora/vue';

// A review form: the rating is submitted as a number (no entry when 0), required inside a field; reset restores defaults.
const sent = ref('');

function submit(e: Event) {
  sent.value = JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]);
}
</script>

<template>
  <ZCard heading="Order review" class="demo-narrow">
    <form @submit.prevent="submit">
      <ZStack>
        <ZField label="Product quality" required>
          <ZRating name="quality" required />
        </ZField>
        <ZRating name="delivery" label="Delivery" :value="4" />
        <ZTextarea name="comment" label="Comment" :rows="3" />
        <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
          <ZButton type="submit">Submit</ZButton>
          <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
        </ZStack>
        <output v-if="sent">{{ sent }}</output>
      </ZStack>
    </form>
  </ZCard>
</template>

```

### Case: half

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZRating, ZStack } from '@zelviora/vue';

// `allow-half`: one slider with steps of 0.5 (click the left or right half of a star, or use the arrow keys).
const value = ref(2.5);
</script>

<template>
  <ZStack class="demo-narrow">
    <ZRating v-model="value" label="Rating" allow-half />
    <span>Value: {{ value }}</span>
  </ZStack>
</template>

```

### Case: i18n

#### Vue
```vue
<script setup lang="ts">
import { ZConfigProvider, ZGrid, ZRating } from '@zelviora/vue';

// Level names and numbers follow the locale ("3,5 sao" / "3.5 stars"); half stars follow the direction in RTL.
</script>

<template>
  <ZGrid columns="1 sm:3" gap="md">
    <ZConfigProvider locale="vi">
      <ZRating label="Tiếng Việt" allow-half :value="3.5" />
    </ZConfigProvider>
    <ZConfigProvider locale="en">
      <ZRating label="English" allow-half :value="3.5" />
    </ZConfigProvider>
    <div dir="rtl" lang="ar-EG">
      <ZRating label="العربية" allow-half :value="3.5" />
    </div>
  </ZGrid>
</template>

```

### Case: sizes

#### Vue
```vue
<script setup lang="ts">
import { ZRating, ZStack } from '@zelviora/vue';

// Small, medium and large; ten levels in a narrow column wrap without overflowing.
</script>

<template>
  <ZStack>
    <ZRating label="Small" size="sm" :value="4" />
    <ZRating label="Medium" size="md" :value="4" />
    <ZRating label="Large" size="lg" :value="4" />
    <ZRating class="demo-narrow" label="Ten levels" :count="10" :value="7" />
  </ZStack>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZGrid, ZRating } from '@zelviora/vue';

// Empty, rated, disabled, readonly (display mode, not focusable) and invalid; hover a star to preview it.
</script>

<template>
  <ZGrid columns="1 sm:2" gap="md">
    <ZRating label="Empty" />
    <ZRating label="Rated" :value="3" />
    <ZRating label="Disabled" :value="3" disabled />
    <ZRating label="Readonly" :value="3" readonly />
    <ZRating label="Invalid" :value="3" invalid />
    <ZRating label="With hint" :value="2" hint="Hover to preview, click to rate" />
  </ZGrid>
</template>

```

### Case: tones

#### Vue
```vue
<script setup lang="ts">
import { ZRating, ZStack } from '@zelviora/vue';

// Warning is the default (traditional yellow stars); any tone colors the selected levels.
</script>

<template>
  <ZStack>
    <ZRating label="Warning" :value="3" />
    <ZRating label="Primary" tone="primary" :value="3" />
    <ZRating label="Destructive" tone="destructive" :value="3" />
  </ZStack>
</template>

```

### Case: validation

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZRating, ZStack } from '@zelviora/vue';

// A required rating left at 0 is reported on submit ("Please choose a rating.").
</script>

<template>
  <form class="demo-narrow" @submit.prevent>
    <ZStack>
      <ZRating name="score" label="Satisfaction" required />
      <ZButton type="submit">Submit</ZButton>
    </ZStack>
  </form>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZResult } from '@zelviora/vue';
</script>

<template>
  <ZResult />
</template>

```

### Case: custom

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZResult } from '@zelviora/vue';
</script>

<template>
  <ZResult status="404" :heading-level="1">
    <svg slot="icon" viewBox="0 0 64 64" width="96" height="96" fill="none" stroke="currentColor" stroke-width="2">
      <circle cx="28" cy="28" r="18" />
      <path d="M41 41l14 14M22 24h.01M34 24h.01M22 34q6-5 12 0" />
    </svg>
    <span slot="heading">Page not found</span>
    <p>The link may have changed. Check the address or try searching.</p>
    <ZButton slot="actions">Go to home page</ZButton>
    <ZButton slot="actions" variant="ghost" tone="neutral">Report a problem</ZButton>
  </ZResult>
</template>

```

### Case: in-form

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZField, ZForm, ZInput, ZResult, ZStack } from '@zelviora/vue';

const order = ref('');
</script>

<template>
  <ZResult v-if="order" live="polite" status="success" heading="Order placed" :description="`Order number: ${order}`">
    <ZButton slot="actions" @click="order = ''">Place another order</ZButton>
  </ZResult>
  <ZForm v-else prevent-submit @z-submit="order = 'DH-0001'">
    <form class="demo-narrow">
      <ZStack>
        <ZField label="Email" required>
          <ZInput name="email" type="email" required />
        </ZField>
        <ZButton type="submit">Place order</ZButton>
      </ZStack>
    </form>
  </ZForm>
</template>

```

### Case: sizes

#### Vue
```vue
<script setup lang="ts">
import { ZCard, ZGrid, ZResult } from '@zelviora/vue';

const sizes = ['sm', 'md', 'lg'] as const;
</script>

<template>
  <ZGrid columns="1 md:3" gap="md">
    <ZCard v-for="size in sizes" :key="size">
      <ZResult :size="size" status="success" :heading-level="3" :heading="`Size ${size}`" description="Payment received." />
    </ZCard>
  </ZGrid>
</template>

```

### Case: statuses

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZCard, ZGrid, ZResult } from '@zelviora/vue';

const statuses = ['success', 'error', 'warning', 'info', '403', '404', '500'] as const;
</script>

<template>
  <ZGrid columns="1 md:2" gap="md">
    <ZCard v-for="status in statuses" :key="status">
      <ZResult :status="status" :heading-level="3">
        <ZButton slot="actions" variant="outline" tone="neutral">Back to home</ZButton>
      </ZResult>
    </ZCard>
  </ZGrid>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
// Importing `@zelviora/third-party/rich-text` once registers the editor engine and the HTML sanitizer (optional peers).
import '@zelviora/third-party/rich-text';
import { ZRichTextEditor } from '@zelviora/vue/third-party';
</script>

<template>
  <div class="demo-narrow">
    <ZRichTextEditor label="Description" name="description" placeholder="Write a short description…" />
  </div>
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import '@zelviora/third-party/rich-text';
import { ZStack } from '@zelviora/vue';
import { ZRichTextEditor } from '@zelviora/vue/third-party';

// v-model binds value (sanitized HTML, '' when empty), model event zInput.
const html = ref('<p>Hello <strong>world</strong></p>');
</script>

<template>
  <div class="demo-narrow">
    <ZStack>
      <ZRichTextEditor v-model="html" label="Message" />
      <output>{{ html || '(empty)' }}</output>
    </ZStack>
  </div>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import '@zelviora/third-party/rich-text';
import { ZButton } from '@zelviora/vue';
import { ZRichTextEditor } from '@zelviora/vue/third-party';
import type { ZRichTextCommand, ZRichTextTool } from '@zelviora/third-party';

// Slotted toolbar buttons (`toolbar-end`) join the toolbar's arrow-key navigation and call `exec()`; the frame and the
// tool buttons are restyled through component tokens and `::part(tool)` (demo-rich-text-brand).
const tools: ZRichTextTool[] = ['bold', 'italic', 'bulletList', 'link'];
const editor = ref<{ $el: HTMLElement & { exec(c: ZRichTextCommand): Promise<boolean> } } | null>(null);
</script>

<template>
  <div class="demo-narrow">
    <ZRichTextEditor ref="editor" class="demo-rich-text-brand" label="Release notes" :toolbar="tools" default-value="<p>Version 2.0 is out.</p>">
      <ZButton slot="toolbar-end" size="sm" variant="ghost" tone="neutral" @click="editor?.$el.exec({ type: 'heading', level: 3 })">Subheading</ZButton>
      <ZButton slot="toolbar-end" size="sm" variant="ghost" tone="neutral" @click="editor?.$el.exec({ type: 'paragraph' })">Plain text</ZButton>
    </ZRichTextEditor>
  </div>
</template>

```

### Case: density

#### Vue
```vue
<script setup lang="ts">
import '@zelviora/third-party/rich-text';
import { ZConfigProvider, ZGrid } from '@zelviora/vue';
import { ZRichTextEditor } from '@zelviora/vue/third-party';

const densities = ['compact', 'default', 'comfortable'] as const;
</script>

<template>
  <!-- Density of the nearest config provider sets the toolbar and frame spacing. -->
  <ZGrid columns="1 md:3" gap="lg">
    <ZConfigProvider v-for="density in densities" :key="density" :density="density">
      <ZRichTextEditor :label="`Density: ${density}`" default-value="<p>Short note.</p>" />
    </ZConfigProvider>
  </ZGrid>
</template>

```

### Case: form

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import '@zelviora/third-party/rich-text';
import { ZButton, ZField, ZForm, ZStack } from '@zelviora/vue';
import { ZRichTextEditor } from '@zelviora/vue/third-party';

const sent = ref('');

function onSubmit(e: CustomEvent<{ values: unknown }>) {
  sent.value = JSON.stringify(e.detail.values);
}
</script>

<template>
  <!-- Inside a field (core) the editor (third-party build) gets the label, hint and error; it submits sanitized HTML. -->
  <ZForm summary prevent-submit @z-submit="onSubmit">
    <form class="demo-narrow">
      <ZStack>
        <ZField label="Product description" hint="At most 200 characters" required>
          <ZRichTextEditor name="body" required :max-length="200" />
        </ZField>
        <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
          <ZButton type="submit">Save</ZButton>
          <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
        </ZStack>
        <output v-if="sent">{{ sent }}</output>
      </ZStack>
    </form>
  </ZForm>
</template>

```

### Case: i18n

#### Vue
```vue
<script setup lang="ts">
import '@zelviora/third-party/rich-text';
import { ZConfigProvider } from '@zelviora/vue';
import { ZRichTextEditor } from '@zelviora/vue/third-party';
</script>

<template>
  <!-- Tool labels and messages follow the locale; Vietnamese input methods (Telex, VNI) compose without losing characters. -->
  <ZConfigProvider locale="vi">
    <div class="demo-narrow">
      <ZRichTextEditor label="Nội dung" :max-length="120" placeholder="Gõ tiếng Việt (Telex, VNI)…" value="<p>Xin chào!</p>" />
    </div>
  </ZConfigProvider>
</template>

```

### Case: images

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import '@zelviora/third-party/rich-text';
import { ZStack } from '@zelviora/vue';
import { ZRichTextEditor } from '@zelviora/vue/third-party';

// 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).
type Editor = HTMLElement & { insertImage(src: string, alt?: string): Promise<void> };
const log = ref<string[]>([]);

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

async function onFileInsert(e: CustomEvent<{ files: File[] }>) {
  const editor = e.target as Editor;
  for (const file of e.detail.files) {
    if (!file.type.startsWith('image/')) { log.value = [`${file.name}: skipped (not an image)`, ...log.value]; continue; }
    const url = await upload(file);
    await editor.insertImage(url, file.name);
    log.value = [`${file.name} (${Math.round(file.size / 1024)} kB) → ${url}`, ...log.value];
  }
}
</script>

<template>
  <div class="demo-narrow">
    <ZStack>
      <ZRichTextEditor label="Post" placeholder="Paste or drop an image here…" :default-value="START" @z-file-insert="onFileInsert" />
      <output>{{ log.length ? log.join(' · ') : 'No file yet' }}</output>
    </ZStack>
  </div>
</template>

```

### Case: long

#### Vue
```vue
<script setup lang="ts">
import '@zelviora/third-party/rich-text';
import { ZRichTextEditor } from '@zelviora/vue/third-party';
import { longDocument } from '../data.ts';
</script>

<template>
  <!-- About 5 000 words and a long URL without spaces; the editing area scrolls (demo-rich-text-long, ::part(editor)). -->
  <ZRichTextEditor class="demo-rich-text-long" label="Annual report" :default-value="longDocument" />
</template>

```

### Case: rtl

#### Vue
```vue
<script setup lang="ts">
import '@zelviora/third-party/rich-text';
import { ZRichTextEditor } from '@zelviora/vue/third-party';
import { arabicText } from '../data.ts';
</script>

<template>
  <!-- RTL: the toolbar and the text start on the right; arrow keys in the toolbar follow the reading order. -->
  <div dir="rtl" lang="ar" class="demo-narrow">
    <ZRichTextEditor label="المحتوى" :default-value="arabicText" />
  </div>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import '@zelviora/third-party/rich-text';
import { ZStack } from '@zelviora/vue';
import { ZRichTextEditor } from '@zelviora/vue/third-party';
</script>

<template>
  <!-- Disabled: no editing and out of the tab order. Read-only: the text can be selected and copied, not changed. -->
  <div class="demo-narrow">
    <ZStack>
      <ZRichTextEditor label="Disabled" disabled value="<p>Nothing to change here.</p>" />
      <ZRichTextEditor label="Read-only" readonly value="<p>Select and copy <em>this</em> text.</p>" />
    </ZStack>
  </div>
</template>

```

### Case: theme

#### Vue
```vue
<script setup lang="ts">
import '@zelviora/third-party/rich-text';
import { ZCard, ZConfigProvider, ZGrid, ZGridItem } from '@zelviora/vue';
import { ZRichTextEditor } from '@zelviora/vue/third-party';

const value = '<p>Some <strong>bold</strong>, <em>italic</em> and <a href="https://example.com">a link</a>.</p>';
</script>

<template>
  <!-- Light and dark side by side: the frame, toolbar and text colors come from tokens. -->
  <ZGrid columns="1 md:2" gap="lg">
    <ZGridItem>
      <ZConfigProvider theme="light">
        <ZCard><ZRichTextEditor label="Light" :default-value="value" /></ZCard>
      </ZConfigProvider>
    </ZGridItem>
    <ZGridItem>
      <ZConfigProvider theme="dark">
        <ZCard><ZRichTextEditor label="Dark" :default-value="value" /></ZCard>
      </ZConfigProvider>
    </ZGridItem>
  </ZGrid>
</template>

```

### Case: toolbar

#### Vue
```vue
<script setup lang="ts">
import '@zelviora/third-party/rich-text';
import type { ZRichTextTool } from '@zelviora/third-party';
import { ZStack } from '@zelviora/vue';
import { ZRichTextEditor } from '@zelviora/vue/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'];
</script>

<template>
  <!-- The toolbar lists the tools in order; Alt+F10 moves to it and the arrow keys move between tools. -->
  <div class="demo-narrow">
    <ZStack>
      <ZRichTextEditor label="Comment (minimal toolbar)" :toolbar="minimal" />
      <ZRichTextEditor label="Article (full toolbar)" :toolbar="full" value="<h2>Title</h2><p>Some <strong>bold</strong> and <code>code</code>.</p>" />
    </ZStack>
  </div>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZSankeyChart } from '@zelviora/vue-chart';
import { sankeyNodes, sankeyLinks, sankeySeries } from '../data.ts';
</script>

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

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/vue';
import {
  ZSankeyChart,
  type ChartPointSelectDetail,
  type ChartSeriesToggleDetail,
} from '@zelviora/vue-chart';
import { sankeyNodes, sankeyLinks, sankeySeries } from '../data.ts';

const hidden = ref<string[]>([]);
const selected = ref('Click any chart element to inspect');

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

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

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" gap="sm" align-items="center" wrap>
      <ZButton size="sm" variant="outline" @click="hidden = []">
        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
      :hidden-series="hidden"
      @z-series-toggle="onToggle"
      @z-point-select="onSelect"
    />
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZSankeyChart } from '@zelviora/vue-chart';
import { sankeyNodes, sankeyLinks, sankeySeries } from '../data.ts';
</script>

<template>
  <ZSankeyChart
    class="demo-chart-brand"
    description="Flow of sessions from acquisition channels through product onboarding to paid plans."
    :value-format="{ maximumFractionDigits: 1 }"
    :nodes="sankeyNodes" :links="sankeyLinks" :series="sankeySeries" node-align="right" renderer="canvas"
  >
    <span slot="heading">User Acquisition to Conversion Flow — Custom Theme Tokens &amp; Canvas</span>
  </ZSankeyChart>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZSankeyChart } from '@zelviora/vue-chart';
import { sankeyNodes, sankeyLinks, sankeySeries } from '../data.ts';
</script>

<template>
  <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."
      show-data-table
      :nodes="sankeyNodes" :links="sankeyLinks" :series="sankeySeries"
    />
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZSankeyChart } from '@zelviora/vue-chart';
import { sankeyNodes, sankeyLinks, sankeySeries } from '../data.ts';
</script>

<template>
  <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" node-align="left" sankey-orient="horizontal"
    />
    <ZSankeyChart
      heading="Vertical Flow Sankey"
      description="Left-aligned horizontal flow vs top-to-bottom vertical Sankey flow."
      :nodes="sankeyNodes" :links="sankeyLinks" :series="sankeySeries" sankey-orient="vertical" node-align="justify"
    />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZScatterChart } from '@zelviora/vue-chart';
import { latencyData, latencySeries } from '../data.ts';
</script>

<template>
  <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."
    x-key="payloadKb" :data="latencyData" :series="latencySeries"
  />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/vue';
import {
  ZScatterChart,
  type ChartPointSelectDetail,
  type ChartSeriesToggleDetail,
} from '@zelviora/vue-chart';
import { latencyData, latencySeries } from '../data.ts';

const hidden = ref<string[]>([]);
const selected = ref('Click any chart element to inspect');

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

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

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" gap="sm" align-items="center" wrap>
      <ZButton size="sm" variant="outline" @click="hidden = []">
        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."
      x-key="payloadKb" :data="latencyData" :series="latencySeries"
      selectable
      :hidden-series="hidden"
      @z-series-toggle="onToggle"
      @z-point-select="onSelect"
    />
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZScatterChart } from '@zelviora/vue-chart';
import { latencyData, latencySeries } from '../data.ts';
</script>

<template>
  <ZScatterChart
    class="demo-chart-brand"
    description="Median (p50) and 95th percentile (p95) latency across payload sizes from 10 kB to 320 kB."
    :value-format="{ maximumFractionDigits: 1 }"
    x-key="payloadKb" :data="latencyData" :series="latencySeries" data-zoom :symbol-size="14" renderer="canvas"
  >
    <span slot="heading">API Response Time vs Payload Size — Custom Theme Tokens &amp; Canvas</span>
  </ZScatterChart>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZScatterChart } from '@zelviora/vue-chart';
import { latencyData, latencySeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZScatterChart
      heading="Loading State (aria-busy)"
      loading
      x-key="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."
      show-data-table
      x-key="payloadKb" :data="latencyData" :series="latencySeries"
    />
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZScatterChart } from '@zelviora/vue-chart';
import { latencyData, latencySeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZScatterChart
      heading="Bubble Size Dimension"
      description="Bubble sizing driven by a data dimension (sizeKey) vs compact uniform markers."
      x-key="payloadKb" :data="latencyData" :series="latencySeries" size-key="weight" :symbol-size="18"
    />
    <ZScatterChart
      heading="Compact Point Markers"
      description="Bubble sizing driven by a data dimension (sizeKey) vs compact uniform markers."
      x-key="payloadKb" :data="latencyData" :series="latencySeries" :symbol-size="8" tooltip-mode="point"
    />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZScrollArea, ZStack } from '@zelviora/vue';

const branches = Array.from({ length: 50 }, (_, i) => `Branch ${i + 1}`);
const top = ref(0);
</script>

<template>
  <ZStack gap="sm" class="demo-narrow">
    <ZScrollArea label="Branches" class="demo-scroll-area" @z-scroll-end="top = Math.round($event.detail.scrollTop)">
      <p v-for="b in branches" :key="b">{{ b }}</p>
    </ZScrollArea>
    <p>Scrolled to: {{ top }}px</p>
  </ZStack>
</template>

```

### Case: fade-edges

#### Vue
```vue
<script setup lang="ts">
import { ZScrollArea } from '@zelviora/vue';

const lines = Array.from({ length: 30 }, (_, i) => `Notification ${i + 1}`);
</script>

<template>
  <ZScrollArea scrollbar="hidden" fade-edges label="Notifications" class="demo-scroll-area demo-narrow">
    <p v-for="l in lines" :key="l">{{ l }}</p>
  </ZScrollArea>
</template>

```

### Case: horizontal

#### Vue
```vue
<script setup lang="ts">
import { ZBadge, ZScrollArea, ZStack } from '@zelviora/vue';

const tags = Array.from({ length: 30 }, (_, i) => `Tag ${i + 1}`);
</script>

<template>
  <ZScrollArea orientation="horizontal" label="Tags" class="demo-narrow">
    <ZStack orientation="horizontal" gap="sm">
      <ZBadge v-for="t in tags" :key="t">{{ t }}</ZBadge>
    </ZStack>
  </ZScrollArea>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZSegmented, ZSegmentedItem } from '@zelviora/vue';
</script>

<template>
  <ZSegmented label="Delivery" block default-value="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>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZSegmented, ZSegmentedItem, ZStack } from '@zelviora/vue';

const value = ref<string | null>('week');
</script>

<template>
  <ZStack gap="sm">
    <ZSegmented v-model="value" label="Calendar view">
      <ZSegmentedItem value="day">Day</ZSegmentedItem>
      <ZSegmentedItem value="week">Week</ZSegmentedItem>
      <ZSegmentedItem value="month">Month</ZSegmentedItem>
    </ZSegmented>
    <p>View: {{ value }}</p>
  </ZStack>
</template>

```

### Case: icon-only

#### Vue
```vue
<script setup lang="ts">
import { ZIcon, ZSegmented, ZSegmentedItem } from '@zelviora/vue';
</script>

<template>
  <ZSegmented label="Layout" size="sm" default-value="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>
</template>

```

### Case: in-form

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZSegmented, ZSegmentedItem, ZStack } from '@zelviora/vue';

const sent = ref('');

function submit(e: Event) {
  sent.value = String(new FormData(e.currentTarget as HTMLFormElement).get('period'));
}
</script>

<template>
  <form @submit.prevent="submit">
    <ZStack gap="sm" align-items="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>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { onBeforeUnmount, onMounted, ref } from 'vue';
import { ZSelect, ZStack } from '@zelviora/vue';

/** 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.
const options = ref<Plan[]>([]);
const loading = ref(true);
let timer: ReturnType<typeof setTimeout> | undefined;

onMounted(() => {
  timer = setTimeout(() => {
    options.value = PLANS;
    loading.value = false;
  }, 1000);
});
onBeforeUnmount(() => clearTimeout(timer));
</script>

<template>
  <ZStack class="demo-narrow">
    <ZSelect label="Plan" :options="options" :loading="loading" value="pro" />
    <ZSelect label="Empty list" :options="[]" placeholder="No plan available" />
  </ZStack>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZSelect, ZSelectGroup, ZSelectOption, ZStack } from '@zelviora/vue';

// v-model binds `value` through the model event `zChange`; clearing sets it to null.
const city = ref<string | null>('hue');
</script>

<template>
  <ZStack class="demo-narrow">
    <ZSelect v-model="city" label="City" hint="Type a letter to jump to a city" clearable>
      <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>
</template>

```

### Case: form

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZField, ZSelect, ZSelectOption, ZStack } from '@zelviora/vue';

// Native form: required single select inside a field, multiple select with several FormData entries, reset.
const sent = ref('');

function submit(e: Event) {
  sent.value = JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]);
}
</script>

<template>
  <form class="demo-narrow" @submit.prevent="submit">
    <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 align-items="center" gap="sm">
        <ZButton type="submit">Submit</ZButton>
        <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
      </ZStack>
      <output v-if="sent">{{ sent }}</output>
    </ZStack>
  </form>
</template>

```

### Case: multiple

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZSelect, ZSelectOption, ZStack } from '@zelviora/vue';

const TOPPINGS = ['Cheese', 'Mushroom', 'Olive', 'Onion', 'Pepper', 'Tomato'];

const value = ref<string[]>(['cheese', 'olive']);
</script>

<template>
  <ZStack class="demo-narrow">
    <ZSelect v-model="value" label="Toppings" multiple clearable :max-tag-count="2">
      <ZSelectOption v-for="t in TOPPINGS" :key="t" :value="t.toLowerCase()">{{ t }}</ZSelectOption>
    </ZSelect>
    <ZSelect v-model="value" label="Responsive summary" multiple size="sm" variant="filled">
      <ZSelectOption v-for="t in TOPPINGS" :key="t" :value="t.toLowerCase()">{{ t }}</ZSelectOption>
    </ZSelect>
    <span>{{ value.length ? value.join(', ') : 'Nothing selected' }}</span>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZSeparator } from '@zelviora/vue';
</script>

<template>
  <div>
    <p>Account settings</p>
    <ZSeparator />
    <p>Notification settings</p>
  </div>
</template>

```

### Case: label

#### Vue
```vue
<script setup lang="ts">
import { ZSeparator, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZStack gap="sm">
    <ZSeparator>OR</ZSeparator>
    <ZSeparator label-placement="start" variant="dashed">Details</ZSeparator>
    <ZSeparator label-placement="end">More</ZSeparator>
  </ZStack>
</template>

```

### Case: vertical

#### Vue
```vue
<script setup lang="ts">
import { ZSeparator, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZStack orientation="horizontal" align-items="center" gap="none">
    <span>Edit</span>
    <ZSeparator orientation="vertical" semantic />
    <span>Share</span>
    <ZSeparator orientation="vertical" semantic />
    <span>Delete</span>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZIcon, ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack } from '@zelviora/vue';

const collapsed = ref(false);
</script>

<template>
  <ZStack orientation="horizontal" class="demo-sidebar-frame">
    <ZSidebar v-model="collapsed" label="Main navigation" collapsible hotkey="Mod+B">
      <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 class="demo-grow">Collapsed: {{ collapsed }}. Press Ctrl+B (⌘B on macOS) to toggle.</p>
  </ZStack>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ZBadge, ZIcon, ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZStack orientation="horizontal" class="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 class="demo-grow">Page content</p>
  </ZStack>
</template>

```

### Case: spa-routing

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZSidebar, ZSidebarGroup, ZSidebarItem, ZStack } from '@zelviora/vue';

const route = ref('#/dashboard');
// One zNavigate listener calls the app router (stand-in for `router.push` of Vue Router).
function navigate(e: CustomEvent<{ href: string }>) {
  e.preventDefault();
  route.value = e.detail.href; // router.push(e.detail.href)
}
// Stand-in for `<RouterLink>`: an `<a href>` that routes on a plain click.
function appLink(e: MouseEvent) {
  if (e.ctrlKey || e.metaKey || e.shiftKey || e.button !== 0) return;
  e.preventDefault();
  route.value = (e.currentTarget as HTMLAnchorElement).getAttribute('href')!;
}
</script>

<template>
  <ZStack orientation="horizontal" class="demo-sidebar-frame">
    <ZSidebar label="Main navigation" @z-navigate="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" @click="appLink">Team</a></ZSidebarItem>
      </ZSidebarGroup>
    </ZSidebar>
    <p aria-live="polite">Current route: <code>{{ route }}</code></p>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZSignature, ZStack } from '@zelviora/vue';

const value = ref('');
</script>

<template>
  <ZStack class="demo-narrow">
    <ZSignature
      v-model="value"
      label="Authorized signature"
      hint="Sign using mouse, trackpad, or stylus"
      show-guide
    />
    <span>Status: {{ value ? `Signed (${value.length} chars)` : 'Empty' }}</span>
  </ZStack>
</template>

```

### Case: form

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZField, ZSignature, ZStack } from '@zelviora/vue';

const sent = ref('');
const submit = (e: Event) => {
  e.preventDefault();
  const data = new FormData(e.target as HTMLFormElement);
  const sig = String(data.get('approvalSignature') ?? '');
  sent.value = sig ? `Submitted (${sig.slice(0, 32)}...)` : 'No signature submitted';
};
</script>

<template>
  <form class="demo-narrow" @submit="submit">
    <ZStack>
      <ZField label="Approval signature" hint="Required before submitting contract" required>
        <ZSignature name="approvalSignature" show-guide required />
      </ZField>
      <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
        <ZButton type="submit">Submit</ZButton>
        <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
      </ZStack>
      <output v-if="sent">{{ sent }}</output>
    </ZStack>
  </form>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZSignature, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZStack class="demo-narrow">
    <ZSignature label="Disabled" disabled show-guide />
    <ZSignature label="Readonly" readonly show-guide />
    <ZSignature label="Warning status" status="warning" hint="Signature differs from file record" />
    <ZSignature label="Invalid" invalid hint="Please provide your signature" />
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZSignature, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZStack class="demo-narrow">
    <ZSignature label="Outline (small)" variant="outline" size="sm" show-guide />
    <ZSignature label="Filled (medium)" variant="filled" size="md" show-guide />
    <ZSignature label="Borderless (large)" variant="borderless" size="lg" show-guide />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZSkeleton } from '@zelviora/vue';
</script>

<template>
  <ZSkeleton width="200px" height="20px" />
</template>

```

### Case: loading

#### Vue
```vue
<script setup lang="ts">
import { onMounted, onUnmounted, ref } from 'vue';
import { ZButton, ZSkeleton, ZStack } from '@zelviora/vue';

const loaded = ref(false);
let timer: ReturnType<typeof setTimeout> | undefined;
function load() {
  loaded.value = false;
  clearTimeout(timer);
  timer = setTimeout(() => (loaded.value = true), 2000);
}
onMounted(load);
onUnmounted(() => clearTimeout(timer));
</script>

<template>
  <ZStack gap="sm" align-items="start">
    <section :aria-busy="!loaded" class="demo-narrow">
      <p v-if="loaded">Your report for September is ready: revenue grew 12% compared with August.</p>
      <ZSkeleton v-else shape="text" :lines="2" />
    </section>
    <ZButton variant="outline" size="sm" :disabled="!loaded" @click="load">Reload</ZButton>
  </ZStack>
</template>

```

### Case: shapes

#### Vue
```vue
<script setup lang="ts">
import { ZSkeleton, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZStack orientation="horizontal" gap="md" align-items="start" aria-busy="true" class="demo-narrow">
    <ZSkeleton shape="circle" width="40px" />
    <!-- demo-grow: the text column takes the rest of the row. -->
    <ZStack gap="sm" class="demo-grow">
      <ZSkeleton shape="text" width="50%" />
      <ZSkeleton shape="text" :lines="3" />
    </ZStack>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZNumberInput, ZSlider, ZStack } from '@zelviora/vue';

// One ref shared by a slider and a number-input (both directions through v-model).
const value = ref<number | null>(25);
</script>

<template>
  <ZStack class="demo-narrow">
    <ZSlider v-model="value" label="Budget share" />
    <ZNumberInput v-model="value" label="Budget share (exact)" :min="0" :max="100" />
  </ZStack>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ZSlider, ZStack } from '@zelviora/vue';

// A 0–100 slider with a hint; the value bubble shows while dragging or focused.
</script>

<template>
  <ZStack class="demo-narrow">
    <ZSlider label="Volume" name="volume" :value="40" hint="Speaker volume" />
    <ZSlider label="Brightness" :value="70" show-value="always" size="lg" />
    <ZSlider label="Locked" :value="20" disabled />
  </ZStack>
</template>

```

### Case: form

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZSlider, ZStack } from '@zelviora/vue';

// The form gets the canonical number; formatValue only changes the bubble and aria-valuetext.
const usd = (v: number, locale: string) => new Intl.NumberFormat(locale, { style: 'currency', currency: 'USD', maximumFractionDigits: 0 }).format(v);
const sent = ref('');

function submit(e: Event) {
  sent.value = JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]);
}
</script>

<template>
  <form class="demo-narrow" @submit.prevent="submit">
    <ZStack>
      <ZSlider label="Budget" name="budget" :min="0" :max="1000" :step="50" :value="300" :format-value="usd" show-value="always" />
      <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
        <ZButton type="submit">Submit</ZButton>
        <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
      </ZStack>
      <output v-if="sent">{{ sent }}</output>
    </ZStack>
  </form>
</template>

```

### Case: i18n

#### Vue
```vue
<script setup lang="ts">
import { ZSlider } from '@zelviora/vue';

// `lang="vi"`: formatValue formats the bubble and aria-valuetext as VND.
const vnd = (v: number, locale: string) => new Intl.NumberFormat(locale, { style: 'currency', currency: 'VND' }).format(v);
</script>

<template>
  <div class="demo-narrow" lang="vi">
    <ZSlider label="Ngân sách" :min="0" :max="1000000" :step="50000" :value="300000" :format-value="vnd" show-value="always" />
  </div>
</template>

```

### Case: marks

#### Vue
```vue
<script setup lang="ts">
import { ZSlider, ZStack } from '@zelviora/vue';

// Marks with labels and snapping to them; `marks` true draws one tick per step.
const marks = [0, 25, 50, 75, 100].map((value) => ({ value, label: `${value}%` }));
</script>

<template>
  <ZStack class="demo-narrow">
    <ZSlider label="Zoom" :marks="marks" snap-to-marks :value="50" />
    <ZSlider label="Rating" :min="0" :max="10" :marks="true" :value="6" />
  </ZStack>
</template>

```

### Case: vertical

#### Vue
```vue
<script setup lang="ts">
import { ZSlider, ZStack } from '@zelviora/vue';

// Vertical sliders: ArrowUp/ArrowRight increase, the bottom is the minimum.
</script>

<template>
  <ZStack orientation="horizontal" gap="lg">
    <ZSlider label="Bass" orientation="vertical" :value="30" />
    <ZSlider label="Treble" orientation="vertical" :value="60" />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
// The card announces loading itself (`aria-busy` and visible text), so the spinner is hidden from assistive technology.
import { ZCard, ZSpinner, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZCard heading="Orders" aria-busy="true" class="demo-narrow">
    <ZStack orientation="horizontal" align-items="center" gap="sm">
      <ZSpinner decorative size="sm" />
      <span>Loading orders…</span>
    </ZStack>
  </ZCard>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ZSpinner } from '@zelviora/vue';
</script>

<template>
  <ZSpinner />
</template>

```

### Case: delay

#### Vue
```vue
<script setup lang="ts">
import { reactive } from 'vue';
import { ZButton, ZSpinner, ZStack } from '@zelviora/vue';

// Loading driven from outside; with `delay` the spinner only appears when loading lasts longer than 300 ms.
const loading = reactive({ fast: false, slow: false });

function run(key: 'fast' | 'slow', ms: number) {
  loading[key] = true;
  setTimeout(() => (loading[key] = false), ms);
}
</script>

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" align-items="center" gap="md" wrap>
      <ZButton variant="outline" tone="neutral" @click="run('fast', 200)">Fast load (200 ms)</ZButton>
      <ZSpinner v-if="loading.fast" :delay="300" show-label />
    </ZStack>
    <ZStack orientation="horizontal" align-items="center" gap="md" wrap>
      <ZButton variant="outline" tone="neutral" @click="run('slow', 2000)">Slow load (2 s)</ZButton>
      <ZSpinner v-if="loading.slow" :delay="300" show-label />
    </ZStack>
  </ZStack>
</template>

```

### Case: label

#### Vue
```vue
<script setup lang="ts">
// The label is the accessible name; `show-label` also shows it next to the spinner.
import { ZSpinner, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZStack gap="md">
    <ZSpinner show-label />
    <ZSpinner show-label tone="primary" label="Loading the order list" />
    <ZSpinner
      show-label
      size="sm"
      label="Synchronizing the quarterly revenue report of every branch, this can take a few minutes"
    />
  </ZStack>
</template>

```

### Case: sizes

#### Vue
```vue
<script setup lang="ts">
import { ZSpinner, ZStack } from '@zelviora/vue';

const sizes = ['xs', 'sm', 'md', 'lg', 'xl'] as const;
</script>

<template>
  <ZStack orientation="horizontal" align-items="center" gap="lg" wrap>
    <ZSpinner v-for="size in sizes" :key="size" :size="size" :label="`Loading (${size})`" />
  </ZStack>
</template>

```

### Case: tones

#### Vue
```vue
<script setup lang="ts">
import { ZSpinner, ZStack } from '@zelviora/vue';

// `current` (default) takes the surrounding text color; the other tones use their semantic color.
const tones = ['neutral', 'primary', 'success', 'warning', 'destructive', 'info'] as const;
</script>

<template>
  <ZStack orientation="horizontal" align-items="center" gap="lg" wrap>
    <span class="demo-text-destructive">
      <ZSpinner size="lg" label="Loading (current color)" />
    </span>
    <ZSpinner v-for="tone in tones" :key="tone" size="lg" :tone="tone" :label="`Loading (${tone})`" />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZCard, ZSplitter, ZSplitterHandle, ZSplitterPanel, ZStack, ZText } from '@zelviora/vue';
import { collapsedLog, collapsibleSplit } from '../data.ts';

const { handleLabel, withGrip, panes: [nav, files] } = collapsibleSplit;
const collapsed = ref(false);

function onCollapse(e: CustomEvent<{ panelIndex: number; collapsed: boolean }>) {
  collapsed.value = e.detail.collapsed;
}
</script>

<template>
  <ZStack gap="sm">
    <ZSplitter class="demo-splitter-frame" @z-collapse-change="onCollapse">
      <ZSplitterPanel :id="nav.id" :default-size="nav.defaultSize" :min-size="nav.minSize" :max-size="nav.maxSize" :collapsible="nav.collapsible">
        <ZCard variant="ghost" :heading="nav.heading">
          <ZText :variant="nav.variant">{{ nav.text }}</ZText>
        </ZCard>
      </ZSplitterPanel>
      <ZSplitterHandle :label="handleLabel" :with-grip="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>
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZCard, ZSplitter, ZSplitterHandle, ZSplitterPanel, ZStack, ZText } from '@zelviora/vue';
import { controlledInitial, controlledLog, controlledPresets, controlledSplit } from '../data.ts';

// v-model binds `value` (percent of every panel) through `zInput`; `zChange` fires once the drag or key step ends.
const { handleLabel, panes: [original, revised] } = controlledSplit;
const value = ref<number[]>(controlledInitial);
const committed = ref<number[]>(controlledInitial);

function onChange(e: CustomEvent<{ value: number[] }>) {
  committed.value = e.detail.value;
}
</script>

<template>
  <ZStack gap="sm">
    <ZStack orientation="horizontal" gap="sm" wrap>
      <ZButton v-for="p in controlledPresets" :key="p.label" size="sm" variant="outline" tone="neutral" @click="value = p.value">{{ p.label }}</ZButton>
    </ZStack>
    <ZSplitter v-model="value" class="demo-splitter-frame" @z-change="onChange">
      <ZSplitterPanel :min-size="original.minSize">
        <ZCard variant="ghost" :heading="original.heading" />
      </ZSplitterPanel>
      <ZSplitterHandle :label="handleLabel" />
      <ZSplitterPanel :min-size="revised.minSize">
        <ZCard variant="ghost" :heading="revised.heading" />
      </ZSplitterPanel>
    </ZSplitter>
    <ZText variant="muted" size="sm">{{ controlledLog(value, committed) }}</ZText>
  </ZStack>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ZCard, ZSplitter, ZSplitterHandle, ZSplitterPanel, ZText } from '@zelviora/vue';
import { defaultSplit } from '../data.ts';

const { handleLabel, panes: [list, message] } = defaultSplit;
</script>

<template>
  <ZSplitter class="demo-splitter-frame">
    <ZSplitterPanel :id="list.id" :default-size="list.defaultSize" :min-size="list.minSize">
      <ZCard variant="ghost" :heading="list.heading">
        <ZText :variant="list.variant">{{ list.text }}</ZText>
      </ZCard>
    </ZSplitterPanel>
    <ZSplitterHandle :label="handleLabel" />
    <ZSplitterPanel :min-size="message.minSize">
      <ZCard variant="ghost" :heading="message.heading">
        <ZText :variant="message.variant">{{ message.text }}</ZText>
      </ZCard>
    </ZSplitterPanel>
  </ZSplitter>
</template>

```

### Case: nested

#### Vue
```vue
<script setup lang="ts">
import { ZCard, ZSplitter, ZSplitterHandle, ZSplitterPanel, ZText } from '@zelviora/vue';
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).
const { panes: [files, main] } = nestedOuter;
const { panes: [editor, terminal] } = nestedInner;
</script>

<template>
  <ZSplitter class="demo-splitter-frame" :persist-key="nestedPersistKey">
    <ZSplitterPanel :id="files.id" :default-size="files.defaultSize" :min-size="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" class="demo-fill">
        <ZSplitterPanel :default-size="editor.defaultSize">
          <ZCard variant="ghost" :heading="editor.heading">
            <ZText :variant="editor.variant">{{ editor.text }}</ZText>
          </ZCard>
        </ZSplitterPanel>
        <ZSplitterHandle :label="nestedInner.handleLabel" :with-grip="nestedInner.withGrip" />
        <ZSplitterPanel :collapsible="terminal.collapsible">
          <ZCard variant="ghost" :heading="terminal.heading">
            <ZText :variant="terminal.variant">{{ terminal.text }}</ZText>
          </ZCard>
        </ZSplitterPanel>
      </ZSplitter>
    </ZSplitterPanel>
  </ZSplitter>
</template>

```

### Case: vertical

#### Vue
```vue
<script setup lang="ts">
import { ZCard, ZSplitter, ZSplitterHandle, ZSplitterPanel, ZText } from '@zelviora/vue';
import { verticalSplit } from '../data.ts';

const { handleLabel, withGrip, panes: [editor, terminal] } = verticalSplit;
</script>

<template>
  <ZSplitter orientation="vertical" class="demo-splitter-frame">
    <ZSplitterPanel :default-size="editor.defaultSize" :min-size="editor.minSize">
      <ZCard variant="ghost" :heading="editor.heading">
        <ZText :variant="editor.variant">{{ editor.text }}</ZText>
      </ZCard>
    </ZSplitterPanel>
    <ZSplitterHandle :label="handleLabel" :with-grip="withGrip" />
    <ZSplitterPanel :min-size="terminal.minSize">
      <ZCard variant="ghost" :heading="terminal.heading">
        <ZText :variant="terminal.variant">{{ terminal.text }}</ZText>
      </ZCard>
    </ZSplitterPanel>
  </ZSplitter>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZCard, ZStack } from '@zelviora/vue';
</script>

<template>
  <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>
</template>

```

### Case: composition

#### Vue
```vue
<script setup lang="ts">
// Dialog-style footer: actions pushed to the inline end (the right in LTR, the left in RTL).
import { ZButton, ZCard, ZStack } from '@zelviora/vue';
</script>

<template>
  <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>
</template>

```

### Case: divider

#### Vue
```vue
<script setup lang="ts">
import { ZLink, ZStack } from '@zelviora/vue';
</script>

<template>
  <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>
</template>

```

### Case: gaps

#### Vue
```vue
<script setup lang="ts">
import { ZBadge, ZStack } from '@zelviora/vue';

/** Gaps come from the --z-gap-* tokens, so they follow the density of the nearest config-provider. */
const gaps = ['none', 'xs', 'sm', 'md', 'lg'] as const;
</script>

<template>
  <ZStack gap="md">
    <ZStack v-for="gap in gaps" :key="gap" orientation="horizontal" :gap="gap">
      <ZBadge variant="solid">gap="{{ gap }}"</ZBadge>
      <ZBadge variant="solid">B</ZBadge>
      <ZBadge variant="solid">C</ZBadge>
    </ZStack>
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZBadge, ZButton, ZStack } from '@zelviora/vue';

const tags = ['design', 'tokens', 'react', 'vue', 'angular', 'accessibility', 'i18n', 'rtl', 'density', 'themes'];
</script>

<template>
  <ZStack gap="lg">
    <ZStack orientation="horizontal" align-items="center" gap="sm">
      <ZButton>Row</ZButton>
      <ZButton variant="outline" tone="neutral">align-items="center"</ZButton>
    </ZStack>
    <ZStack orientation="horizontal" wrap gap="xs">
      <ZBadge v-for="tag in tags" :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>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZStatistic } from '@zelviora/vue';
</script>

<template>
  <ZStatistic label="Active users" :value="112893" />
</template>

```

### Case: countdown

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZStack, ZStatistic } from '@zelviora/vue';

const inSeconds = (s: number) => Date.now() + s * 1000;
const sale = inSeconds(2 * 3600 + 15 * 60);
const quiz = ref(inSeconds(10));
const done = ref(false);
const restart = () => {
  done.value = false;
  quiz.value = inSeconds(10);
};
</script>

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" wrap gap="lg">
      <ZStatistic label="Flash sale ends in" :countdown-to="sale" />
      <ZStatistic label="Quiz" :countdown-to="quiz" @z-finish="done = true" />
    </ZStack>
    <ZStack orientation="horizontal" align-items="center" gap="sm">
      <ZButton variant="outline" tone="neutral" @click="restart">Restart quiz</ZButton>
      <span>{{ done ? 'Time is up' : 'Running' }}</span>
    </ZStack>
  </ZStack>
</template>

```

### Case: dashboard

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZCard, ZGrid, ZStack, ZStatistic } from '@zelviora/vue';

const visits = ref(8240);
</script>

<template>
  <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" @click="visits += 37">Refresh</ZButton>
    </ZStack>
  </ZStack>
</template>

```

### Case: formats

#### Vue
```vue
<script setup lang="ts">
import { ZGrid, ZStatistic } from '@zelviora/vue';
</script>

<template>
  <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>
</template>

```

### Case: i18n

#### Vue
```vue
<script setup lang="ts">
import { ZGrid, ZStatistic } from '@zelviora/vue';
</script>

<template>
  <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>
</template>

```

### Case: sizes

#### Vue
```vue
<script setup lang="ts">
import { ZStack, ZStatistic } from '@zelviora/vue';

const sizes = ['sm', 'md', 'lg'] as const;
</script>

<template>
  <ZStack orientation="horizontal" wrap gap="lg">
    <ZStatistic v-for="size in sizes" :key="size" :size="size" :label="`Size ${size}`" :value="2048" />
  </ZStack>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack, ZStatistic } from '@zelviora/vue';

// Not a finite number: shown as "—".
const invalid = Number.NaN;
</script>

<template>
  <ZStack orientation="horizontal" wrap gap="lg">
    <ZStatistic label="Loading" :value="100" loading />
    <ZStatistic label="Invalid value" :value="invalid" />
    <ZStatistic label="Text value" value="N/A" />
  </ZStack>
</template>

```

### Case: trends

#### Vue
```vue
<script setup lang="ts">
import { ZGrid, ZStatistic } from '@zelviora/vue';
</script>

<template>
  <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" trend-sentiment="negative" :delta="0.08" />
    <ZStatistic label="Refunds" :value="12" trend="neutral" :delta="0" />
  </ZGrid>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZStep, ZSteps } from '@zelviora/vue';
</script>

<template>
  <ZSteps :current="1" label="Checkout progress">
    <ZStep>Cart</ZStep>
    <ZStep description="Address and method">Shipping</ZStep>
    <ZStep>Payment</ZStep>
  </ZSteps>
</template>

```

### Case: navigable

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZStack, ZStep, ZSteps } from '@zelviora/vue';

const titles = ['Account', 'Profile', 'Preferences', 'Review'];
const current = ref(0);
</script>

<template>
  <ZStack gap="md">
    <ZSteps v-model="current" navigable linear label="Sign-up progress">
      <ZStep v-for="t in titles" :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" @click="current--">Back</ZButton>
      <ZButton :disabled="current === titles.length - 1" @click="current++">Next</ZButton>
    </ZStack>
  </ZStack>
</template>

```

### Case: vertical

#### Vue
```vue
<script setup lang="ts">
import { ZStep, ZSteps } from '@zelviora/vue';
</script>

<template>
  <ZSteps :current="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>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZSunburstChart } from '@zelviora/vue-chart';
import { storageTree, storageSeries } from '../data.ts';
</script>

<template>
  <ZSunburstChart
    heading="Cloud Storage Partition by Region and Tier (TB)"
    description="Concentric rings break down total storage across geographic regions and storage classes."
    :tree-data="storageTree" :series="storageSeries"
  />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/vue';
import {
  ZSunburstChart,
  type ChartPointSelectDetail,
  type ChartSeriesToggleDetail,
} from '@zelviora/vue-chart';
import { storageTree, storageSeries } from '../data.ts';

const hidden = ref<string[]>([]);
const selected = ref('Click any chart element to inspect');

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

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

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" gap="sm" align-items="center" wrap>
      <ZButton size="sm" variant="outline" @click="hidden = []">
        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."
      :tree-data="storageTree" :series="storageSeries"
      selectable
      :hidden-series="hidden"
      @z-series-toggle="onToggle"
      @z-point-select="onSelect"
    />
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZSunburstChart } from '@zelviora/vue-chart';
import { storageTree, storageSeries } from '../data.ts';
</script>

<template>
  <ZSunburstChart
    class="demo-chart-brand"
    description="Concentric rings break down total storage across geographic regions and storage classes."
    :value-format="{ maximumFractionDigits: 1 }"
    :tree-data="storageTree" :series="storageSeries" inner-radius="22%" outer-radius="88%" renderer="canvas"
  >
    <span slot="heading">Cloud Storage Partition by Region and Tier (TB) — Custom Theme Tokens &amp; Canvas</span>
  </ZSunburstChart>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZSunburstChart } from '@zelviora/vue-chart';
import { storageTree, storageSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZSunburstChart
      heading="Loading State (aria-busy)"
      loading
      :tree-data="storageTree" :series="storageSeries"
    />
    <ZSunburstChart
      heading="Empty State"
      :tree-data="[]"
      :series="storageSeries"
    />
    <ZSunburstChart
      heading="Expanded Accessible Data Table"
      description="Concentric rings break down total storage across geographic regions and storage classes."
      show-data-table
      :tree-data="storageTree" :series="storageSeries"
    />
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZSunburstChart } from '@zelviora/vue-chart';
import { storageTree, storageSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZSunburstChart
      heading="Hollow Core Sunburst"
      description="Hollow center ring (28%–86%) vs full-center sunburst without sector labels."
      :tree-data="storageTree" :series="storageSeries" inner-radius="28%" outer-radius="86%"
    />
    <ZSunburstChart
      heading="Solid Center Sunburst"
      description="Hollow center ring (28%–86%) vs full-center sunburst without sector labels."
      :tree-data="storageTree" :series="storageSeries" inner-radius="0%" outer-radius="78%" :show-label="false"
    />
  </ZStack>
</template>

```


================================================================================
# COMPONENT: SVG
================================================================================

## Documentation

# SVG Angular Demos

Demo cases for `<z-svg>` in Angular.


## Examples & Implementation

### Case: basic

#### Vue
```vue
<script setup lang="ts">
import { ZSvg, ZStack } from '@zelviora/vue';

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>`;
</script>

<template>
  <ZStack orientation="horizontal" gap="lg" align-items="center">
    <ZSvg :src="SAMPLE_SVG" image-title="Default size SVG" />
    <ZSvg :src="SAMPLE_SVG" image-title="Medium size SVG" size="32px" color="var(--z-color-primary)" />
    <ZSvg :src="SAMPLE_SVG" image-title="Large size SVG" size="48px" color="var(--z-color-success)" />
  </ZStack>
</template>

```

### Case: preview

#### Vue
```vue
<script setup lang="ts">
import { ZSvg, ZStack, ZText } from '@zelviora/vue';

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>`;
</script>

<template>
  <ZStack gap="sm">
    <ZText variant="muted" size="sm">
      Click the SVG graphic below to open full-screen lightbox preview:
    </ZText>
    <ZSvg
      :src="DETAILED_SVG"
      image-title="Verified badge"
      :preview="true"
      size="64px"
    />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZStack, ZSwitch } from '@zelviora/vue';

const on = ref(false);
</script>

<template>
  <ZStack gap="sm">
    <ZSwitch v-model="on" name="notify">Email notifications</ZSwitch>
    <p>Notifications are {{ on ? 'on' : 'off' }}.</p>
  </ZStack>
</template>

```

### Case: form

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZStack, ZSwitch } from '@zelviora/vue';

const sent = ref('');

function submit(e: Event) {
  sent.value = JSON.stringify(Object.fromEntries(new FormData(e.currentTarget as HTMLFormElement)));
}
</script>

<template>
  <form @submit.prevent="submit">
    <ZStack>
      <ZSwitch name="terms" value="accepted" required>Accept the terms</ZSwitch>
      <ZStack orientation="horizontal" wrap align-items="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>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack, ZSwitch } from '@zelviora/vue';
</script>

<template>
  <ZStack gap="sm">
    <ZSwitch size="sm">Small</ZSwitch>
    <ZSwitch checked>Medium, on</ZSwitch>
    <ZSwitch size="lg" hint="Sent every Monday.">Large with a hint</ZSwitch>
    <ZSwitch disabled checked>Disabled</ZSwitch>
    <ZSwitch readonly checked>Read-only</ZSwitch>
    <ZSwitch label-placement="start">Label before the switch</ZSwitch>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZStack, ZTable } from '@zelviora/vue';

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

<template>
  <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>
</template>

```

### Case: basic

#### Vue
```vue
<script setup lang="ts">
import { ZTable } from '@zelviora/vue';

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

<template>
  <ZTable caption="Users" row-header="name" :columns="columns" :rows="rows" />
</template>

```

### Case: conditional

#### Vue
```vue
<script setup lang="ts">
import { ZTable } from '@zelviora/vue';

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).
const rowParts = (r: Invoice) => (r.overdue ? ['overdue'] : []);
const cellParts = (r: Invoice, col: string) => (col === 'balance' && r.balance < 0 ? ['negative'] : []);
</script>

<template>
  <ZTable
    class="demo-table-invoices"
    caption="Invoices"
    :columns="columns"
    :rows="rows"
    :row-parts="rowParts"
    :cell-parts="cellParts"
  />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { computed, ref } from 'vue';
import { ZStack, ZTable } from '@zelviora/vue';

type Sort = Array<{ key: string; direction: 'ascending' | 'descending' }>;

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). */
const sort = ref<Sort>([{ key: 'population', direction: 'descending' }]);
const rows = computed(() => {
  const s = sort.value[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)));
  });
});

function onSortChange(e: CustomEvent<{ sort: Sort }>) {
  sort.value = e.detail.sort;
}
</script>

<template>
  <ZStack gap="sm">
    <ZTable caption="Cities" processing="manual" :sort="sort" :columns="columns" :rows="rows" @z-sort-change="onSortChange" />
    <p>Current sort: {{ sort[0] ? `${sort[0].key} ${sort[0].direction}` : 'none' }}</p>
  </ZStack>
</template>

```

### Case: footer

#### Vue
```vue
<script setup lang="ts">
import { ZTable } from '@zelviora/vue';

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

const total = new Intl.NumberFormat('en', { style: 'currency', currency: 'USD' }).format(rows.reduce((s, r) => s + r.amount, 0));
</script>

<template>
  <ZTable caption="Monthly costs" hide-caption row-header="item" :columns="columns" :rows="rows">
    <strong slot="footer">Total: {{ total }}</strong>
  </ZTable>
</template>

```

### Case: formatting

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZStack, ZTable } from '@zelviora/vue';

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

const lang = ref<'en' | 'de'>('en');
</script>

<template>
  <ZStack :lang="lang" gap="sm" align-items="start">
    <ZButton variant="outline" tone="neutral" @click="lang = lang === 'de' ? 'en' : 'de'">
      Switch to {{ lang === 'de' ? 'English' : 'German' }}
    </ZButton>
    <ZTable caption="Orders" :columns="columns" :rows="rows" />
  </ZStack>
</template>

```

### Case: grouped

#### Vue
```vue
<script setup lang="ts">
import { ZTable } from '@zelviora/vue';

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

<template>
  <ZTable caption="Staff" row-header="general.name" :columns="columns" :rows="rows" />
</template>

```

### Case: pinned

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZContainer, ZTable } from '@zelviora/vue';

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])),
}));
</script>

<template>
  <!-- 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" sticky-header max-height="16rem">
      <ZButton v-for="r in rows" :key="r.key" :slot="`cell:${r.key}:actions`" size="sm" variant="ghost">Edit</ZButton>
    </ZTable>
  </ZContainer>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZStack, ZTable } from '@zelviora/vue';

const columns = [
  { key: 'name', header: 'Name' },
  { key: 'status', header: 'Status' },
];

const data = [
  { key: 'a', name: 'Backup', status: 'Done' },
  { key: 'b', name: 'Import', status: 'Running' },
];

const loading = ref(false);
</script>

<template>
  <ZStack gap="lg">
    <ZTable caption="Loading without rows" loading :columns="columns" :rows="[]" />
    <ZTable caption="Empty" :columns="columns" :rows="[]" empty-text="No jobs yet" />
    <ZStack gap="sm" align-items="start">
      <ZButton variant="outline" tone="neutral" @click="loading = !loading">
        {{ loading ? 'Stop loading' : 'Reload' }}
      </ZButton>
      <ZTable caption="Loading with rows (rows are dimmed)" :loading="loading" :columns="columns" :rows="data" />
    </ZStack>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZTabs, ZTabsList, ZTabsPanel, ZTabsTrigger } from '@zelviora/vue';

let next = 4;

const tabs = ref(['1', '2', '3']);
const value = ref('1');

function add() {
  const id = String(next++);
  tabs.value.push(id);
  value.value = id;
}

function onClose(e: CustomEvent<{ value: string }>) {
  tabs.value = tabs.value.filter((id) => id !== e.detail.value);
}
</script>

<template>
  <ZTabs v-model="value" overflow="menu" @z-close="onClose">
    <ZButton slot="end" variant="ghost" tone="neutral" size="sm" label="Add tab" @click="add">+</ZButton>
    <ZTabsList label="Open documents">
      <ZTabsTrigger v-for="id in tabs" :key="id" :value="id" closable>Document {{ id }}</ZTabsTrigger>
    </ZTabsList>
    <ZTabsPanel v-for="id in tabs" :key="id" :value="id">
      Content of document {{ id }}. Press Delete on a tab to close it.
    </ZTabsPanel>
  </ZTabs>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ZTabs, ZTabsList, ZTabsPanel, ZTabsTrigger } from '@zelviora/vue';
</script>

<template>
  <ZTabs default-value="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>
</template>

```

### Case: overflow

#### Vue
```vue
<script setup lang="ts">
import { ZStack, ZTabs, ZTabsList, ZTabsPanel, ZTabsTrigger } from '@zelviora/vue';

const months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
const modes = ['scroll', 'menu'] as const;
</script>

<template>
  <ZStack orientation="vertical" gap="lg" class="demo-narrow">
    <ZTabs v-for="overflow in modes" :key="overflow" default-value="January" :overflow="overflow">
      <ZTabsList :label="`Monthly reports (${overflow})`">
        <ZTabsTrigger v-for="m in months" :key="m" :value="m">{{ m }} report</ZTabsTrigger>
      </ZTabsList>
      <ZTabsPanel v-for="m in months" :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>
</template>

```

### Case: vertical

#### Vue
```vue
<script setup lang="ts">
import { ZTabs, ZTabsList, ZTabsPanel, ZTabsTrigger } from '@zelviora/vue';
</script>

<template>
  <ZTabs orientation="vertical" variant="soft" activation-mode="manual" default-value="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>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZStack, ZTag } from '@zelviora/vue';
</script>

<template>
  <ZStack orientation="horizontal" gap="sm" wrap>
    <ZTag>New</ZTag>
    <ZTag tone="success">Approved</ZTag>
    <ZTag tone="warning">Pending</ZTag>
  </ZStack>
</template>

```

### Case: icon

#### Vue
```vue
<script setup lang="ts">
import { ZAvatar, ZIcon, ZStack, ZTag } from '@zelviora/vue';
</script>

<template>
  <ZStack orientation="horizontal" align-items="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>
</template>

```

### Case: removable

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZStack, ZTag, ZText } from '@zelviora/vue';

const provinces = ['London', 'Boston', 'Sydney', 'Toronto', 'San Francisco – Mission District Regional Office'];
const items = ref([...provinces]);
function onRemove(e: CustomEvent<{ value: string | undefined }>) {
  items.value = items.value.filter((n) => n !== e.detail.value);
}
function reset() {
  items.value = [...provinces];
}
</script>

<template>
  <ZStack gap="sm">
    <ZStack orientation="horizontal" gap="sm" wrap>
      <ZTag v-for="name in items" :key="name" removable :value="name" @z-remove="onRemove">{{ name }}</ZTag>
    </ZStack>
    <ZStack orientation="horizontal" align-items="center" gap="sm">
      <ZText variant="muted" size="sm">{{ items.length }} selected</ZText>
      <ZButton size="sm" variant="ghost" tone="neutral" @click="reset">Reset</ZButton>
    </ZStack>
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZStack, ZTag } from '@zelviora/vue';

const variants = ['soft', 'solid', 'outline'] as const;
const tones = ['neutral', 'primary', 'success', 'warning', 'destructive', 'info'] as const;
const sizes = ['sm', 'md', 'lg'] as const;
</script>

<template>
  <ZStack gap="md">
    <ZStack v-for="variant in variants" :key="variant" orientation="horizontal" gap="sm" wrap>
      <ZTag v-for="tone in tones" :key="tone" :variant="variant" :tone="tone">{{ tone }}</ZTag>
    </ZStack>
    <ZStack orientation="horizontal" align-items="center" gap="sm">
      <ZTag v-for="size in sizes" :key="size" :size="size" removable>Size {{ size }}</ZTag>
      <ZTag removable disabled>Disabled</ZTag>
    </ZStack>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZStack, ZTagsInput } from '@zelviora/vue';

// Enter or a comma adds a tag; Backspace in the empty input reaches the last tag; clear all.
const tags = ref<string[]>([]);
</script>

<template>
  <ZStack class="demo-narrow">
    <ZTagsInput v-model="tags" label="Keywords" placeholder="Type, then press Enter" clearable />
    <span>Value: {{ tags.length ? tags.join(' | ') : 'none' }}</span>
  </ZStack>
</template>

```

### Case: editable

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZStack, ZTagsInput } from '@zelviora/vue';

// Double-click, Enter or F2 on a tag edits it; at most 5 tags, at least 2.
const labels = ref<string[]>(['urgent', 'frontend', 'in progress']);
</script>

<template>
  <ZStack class="demo-narrow">
    <ZTagsInput v-model="labels" label="Labels" hint="2 to 5 labels; double-click a tag to edit it" editable :max-count="5" :min-count="2" />
  </ZStack>
</template>

```

### Case: form

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZField, ZStack, ZTagsInput } from '@zelviora/vue';

// Native form: one FormData entry per tag (getAll); required inside a field; reset.
const sent = ref('');

function submit(e: Event) {
  sent.value = JSON.stringify(new FormData(e.currentTarget as HTMLFormElement).getAll('to'));
}
</script>

<template>
  <form class="demo-narrow" @submit.prevent="submit">
    <ZStack>
      <ZField label="Recipients" hint="Press Enter after each address" required>
        <ZTagsInput name="to" required />
      </ZField>
      <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
        <ZButton type="submit">Submit</ZButton>
        <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
      </ZStack>
      <output v-if="sent">{{ sent }}</output>
    </ZStack>
  </form>
</template>

```

### Case: validate

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZStack, ZTagsInput } from '@zelviora/vue';

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.
const error = ref('');

function onError(e: CustomEvent<{ error: { reason: string; tag: string } }>) {
  error.value = `${e.detail.error.reason}: ${e.detail.error.tag}`;
}
</script>

<template>
  <ZStack class="demo-narrow">
    <ZTagsInput label="Email" hint="Paste or type addresses separated by , ; or a space" :delimiters="DELIMITERS" :validate="isEmail" @z-error="onError" />
    <span>Last rejection: {{ error || 'none' }}</span>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import {
  ZStack,
  ZTerminal,
  ZText,
  type ZTerminalCommandDefinition,
  type ZTerminalEntry,
} from '@zelviora/vue';

const initialEntries: ZTerminalEntry[] = [
  { id: 'init-1', kind: 'command', text: 'status', prompt: '$', cwd: '~/zelviora' },
  {
    id: 'init-2',
    kind: 'output',
    text: '\u001b[1;32m● healthy\u001b[0m  api-gateway (v2.4.1) · 3/3 replicas ready · latency 14ms',
  },
];

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(' '),
  },
];
</script>

<template>
  <ZStack gap="sm">
    <ZTerminal
      class="demo-terminal-frame"
      heading="zelviora-cli — zsh"
      cwd="~/zelviora"
      welcome-message="zelviora Cloud Shell v2.4 — Type 'help' to list commands or press Tab to autocomplete."
      :entries="initialEntries"
      :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>
</template>

```

### Case: i18n

#### Vue
```vue
<script setup lang="ts">
import {
  ZStack,
  ZTerminal,
  type ZTerminalCommandDefinition,
  type ZTerminalEntry,
} from '@zelviora/vue';

const nhatKyDau: ZTerminalEntry[] = [
  { id: 'vi-1', kind: 'command', text: 'trang-thai', prompt: '$', cwd: '~/du-an' },
  {
    id: 'vi-2',
    kind: 'success',
    text: 'Hệ thống đang hoạt động ổn định (3/3 máy chủ sẵn sàng).',
  },
];

const lenhHoTro: ZTerminalCommandDefinition[] = [
  {
    name: 'trang-thai',
    description: 'Kiểm tra tình trạng cụm máy chủ',
    handler: () => ({
      kind: 'success',
      text: 'Tất cả dịch vụ phản hồi bình thường (độ trễ trung bình 12ms).',
    }),
  },
  {
    name: 'phien-ban',
    description: 'Xem phiên bản hệ thống hiện tại',
    handler: () => 'zelviora CLI phiên bản 0.1.0 (nhân Linux x86_64)',
  },
];
</script>

<template>
  <ZStack>
    <ZTerminal
      class="demo-terminal-frame"
      lang="vi"
      cwd="~/du-an"
      welcome-message="Chào mừng đến với cửa sổ dòng lệnh zelviora. Gõ 'help' để xem các lệnh hỗ trợ."
      :entries="nhatKyDau"
      :commands="lenhHoTro"
    />
  </ZStack>
</template>

```

### Case: readonly

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import {
  ZButton,
  ZStack,
  ZTerminal,
  type ZTerminalEntry,
  type ZTerminalTheme,
} from '@zelviora/vue';

const theme = ref<ZTerminalTheme>('dark');
const entries = ref<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)',
  },
]);

function appendLog() {
  const nextIndex = entries.value.length + 1;
  const now = new Date().toTimeString().slice(0, 8);
  entries.value = [
    ...entries.value,
    {
      id: `log-${nextIndex}`,
      kind: 'output',
      timestamp: now,
      text: `\u001b[1;32mOK\u001b[0m    [health] Heartbeat check #${nextIndex} completed in 6ms`,
    },
  ];
}
</script>

<template>
  <ZStack gap="sm">
    <ZStack orientation="horizontal" align-items="center" gap="sm" wrap>
      <ZButton :variant="theme === 'dark' ? 'solid' : 'outline'" size="sm" @click="theme = 'dark'">
        Dark
      </ZButton>
      <ZButton :variant="theme === 'light' ? 'solid' : 'outline'" size="sm" @click="theme = 'light'">
        Light
      </ZButton>
      <ZButton :variant="theme === 'auto' ? 'solid' : 'outline'" size="sm" @click="theme = 'auto'">
        Auto
      </ZButton>
      <ZButton variant="soft" size="sm" @click="appendLog">Append log line</ZButton>
    </ZStack>
    <ZTerminal
      class="demo-terminal-frame"
      heading="k8s-pod/api-gateway-7f9c — logs"
      :theme="theme"
      readonly
      timestamps
      :entries="entries"
    />
  </ZStack>
</template>

```

### Case: streaming

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import {
  ZButton,
  ZStack,
  ZTerminal,
  type ZTerminalCommandHandler,
  type ZTerminalEntry,
} from '@zelviora/vue';

type TerminalHandle = {
  $el?: HTMLElement & { execute?: (rawCommand: string) => Promise<void> };
  execute?: (rawCommand: string) => Promise<void>;
};

const termRef = ref<TerminalHandle | null>(null);

const initialSteps: 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 streamHandler: ZTerminalCommandHandler = async (command, _args, _raw, ctx) => {
  if (command === 'clear') {
    ctx.clear();
    return;
  }
  if (command === 'build') {
    ctx.writeln('\u001b[1;36m[1/3]\u001b[0m Compiling design tokens and Stencil components…');
    await waitStep(350, ctx.signal);
    ctx.writeln('\u001b[1;36m[2/3]\u001b[0m Generating React, Vue, and Angular wrappers…');
    await waitStep(350, ctx.signal);
    ctx.writeln('\u001b[1;32m[3/3] ✓ Build succeeded in 1.42s (0 warnings)\u001b[0m');
    return;
  }
  if (command === 'test') {
    ctx.writeln('\u001b[1;34mRUN\u001b[0m  packages/core/terminal.spec.tsx');
    await waitStep(300, ctx.signal);
    ctx.writeln(' \u001b[1;32m✓\u001b[0m ANSI SGR parser & tokenizer (2ms)');
    await waitStep(300, ctx.signal);
    ctx.writeln(' \u001b[1;32m✓\u001b[0m Keyboard history, Tab completion & axe audit (18ms)');
    return { kind: 'success', text: 'Test Suites: 1 passed · Tests: 12 passed' };
  }
  return {
    kind: 'warning',
    text: `Unknown task "${command}". Try "build", "test", or "clear".`,
  };
};

function runTask(cmd: string) {
  const el = termRef.value?.$el ?? termRef.value;
  void el?.execute?.(cmd);
}
</script>

<template>
  <ZStack gap="sm">
    <ZStack orientation="horizontal" align-items="center" gap="sm" wrap>
      <ZButton variant="solid" size="sm" @click="runTask('build')">Run build</ZButton>
      <ZButton variant="outline" size="sm" @click="runTask('test')">Run tests</ZButton>
    </ZStack>
    <ZTerminal
      ref="termRef"
      class="demo-terminal-frame"
      heading="ci-runner — pipeline"
      cwd="~/workspace"
      :entries="initialSteps"
      :command-handler="streamHandler"
    />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZStack, ZText } from '@zelviora/vue';

// Vietnamese diacritics stack above and below the letters (Ễ Ỗ Ữ): no variant clips them.
const variants = ['body', 'muted', 'strong', 'caption', 'code'] as const;
</script>

<template>
  <ZStack gap="sm">
    <ZText v-for="variant in variants" :key="variant" as="p" :variant="variant" lang="vi">{{ variant }}: Tiếng Việt có dấu chồng — Ễ Ỗ Ữ</ZText>
  </ZStack>
</template>

```

### Case: truncate

#### Vue
```vue
<script setup lang="ts">
import { ZHeading, ZStack, ZText } from '@zelviora/vue';

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.';
</script>

<template>
  <ZStack gap="md" class="demo-narrow">
    <ZHeading :level="3" size="md" truncate>{{ long }}</ZHeading>
    <ZText as="p" :truncate="3">{{ long }} {{ long }}</ZText>
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZStack, ZText } from '@zelviora/vue';

const variants = ['body', 'muted', 'strong', 'caption', 'code'] as const;
const tones = ['primary', 'success', 'warning', 'destructive', 'info'] as const;
</script>

<template>
  <ZStack gap="sm">
    <ZText v-for="variant in variants" :key="variant" as="p" :variant="variant">{{ variant }}: The quick brown fox jumps over the lazy dog</ZText>
    <ZStack orientation="horizontal" gap="md" wrap>
      <ZText v-for="tone in tones" :key="tone" :tone="tone">{{ tone }}</ZText>
    </ZStack>
    <ZStack orientation="horizontal" align-items="center" gap="md">
      <ZText size="sm">Small</ZText>
      <ZText size="md">Medium</ZText>
      <ZText size="lg">Large</ZText>
    </ZStack>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZTextarea } from '@zelviora/vue';
</script>

<template>
  <div class="demo-narrow">
    <ZTextarea label="Message" auto-resize :rows="2" :max-rows="6" hint="Grows from 2 to 6 lines, then scrolls" />
  </div>
</template>

```

### Case: basic

#### Vue
```vue
<script setup lang="ts">
import { ZTextarea } from '@zelviora/vue';
</script>

<template>
  <ZTextarea label="Note" name="note" placeholder="Anything we should know?" />
</template>

```

### Case: count

#### Vue
```vue
<script setup lang="ts">
import { ZTextarea } from '@zelviora/vue';
</script>

<template>
  <div class="demo-narrow">
    <ZTextarea label="Review" name="review" show-count clearable :max-length="200" :min-length="20" value="The pho was great 🍜" />
  </div>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZThemeRiverChart } from '@zelviora/vue-chart';
import { riverItems, riverSeries } from '../data.ts';
</script>

<template>
  <ZThemeRiverChart
    heading="Documentation Search Topic Streamgraph"
    description="Evolution of search interest across Components, Tokens, and Charts over four weeks."
    :river-data="riverItems" :series="riverSeries"
  />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/vue';
import {
  ZThemeRiverChart,
  type ChartPointSelectDetail,
  type ChartSeriesToggleDetail,
} from '@zelviora/vue-chart';
import { riverItems, riverSeries } from '../data.ts';

const hidden = ref<string[]>([]);
const selected = ref('Click any chart element to inspect');

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

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

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" gap="sm" align-items="center" wrap>
      <ZButton size="sm" variant="outline" @click="hidden = []">
        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."
      :river-data="riverItems" :series="riverSeries"
      selectable
      :hidden-series="hidden"
      @z-series-toggle="onToggle"
      @z-point-select="onSelect"
    />
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZThemeRiverChart } from '@zelviora/vue-chart';
import { riverItems, riverSeries } from '../data.ts';
</script>

<template>
  <ZThemeRiverChart
    class="demo-chart-brand"
    description="Evolution of search interest across Components, Tokens, and Charts over four weeks."
    :value-format="{ maximumFractionDigits: 1 }"
    :river-data="riverItems" :series="riverSeries" renderer="canvas"
  >
    <span slot="heading">Documentation Search Topic Streamgraph — Custom Theme Tokens &amp; Canvas</span>
  </ZThemeRiverChart>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZThemeRiverChart } from '@zelviora/vue-chart';
import { riverItems, riverSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZThemeRiverChart
      heading="Loading State (aria-busy)"
      loading
      :river-data="riverItems" :series="riverSeries"
    />
    <ZThemeRiverChart
      heading="Empty State"
      :river-data="[]"
      :series="riverSeries"
    />
    <ZThemeRiverChart
      heading="Expanded Accessible Data Table"
      description="Evolution of search interest across Components, Tokens, and Charts over four weeks."
      show-data-table
      :river-data="riverItems" :series="riverSeries"
    />
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZThemeRiverChart } from '@zelviora/vue-chart';
import { riverItems, riverSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZThemeRiverChart
      heading="Labeled Stream Ribbons"
      description="Streamgraph with inline series labels vs clean unlabeled stream ribbons."
      :river-data="riverItems" :series="riverSeries" show-label
    />
    <ZThemeRiverChart
      heading="Clean Streamgraph Ribbons"
      description="Streamgraph with inline series labels vs clean unlabeled stream ribbons."
      :river-data="riverItems" :series="riverSeries" :show-label="false"
    />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZStack, ZTimePicker } from '@zelviora/vue';

// The app owns `value` (v-model): buttons set it from code (no event), the log lists user changes and popup changes.
const value = ref<string | null>('09:00');
const log = ref<string[]>([]);
const add = (line: string) => { log.value = [line, ...log.value].slice(0, 5); };
const now = () => '09:41';

function onChange(e: CustomEvent<{ value: string | null }>) {
  add(`zChange ${e.detail.value}`);
}
function onOpen(e: CustomEvent<{ open: boolean; reason: string }>) {
  add(`zOpenChange ${e.detail.open} (${e.detail.reason})`);
}
</script>

<template>
  <ZStack class="demo-narrow">
    <ZTimePicker v-model="value" label="Reminder time" :now="now" @z-change="onChange" @z-open-change="onOpen" />
    <ZStack orientation="horizontal" gap="sm" wrap>
      <ZButton variant="outline" tone="neutral" @click="value = '17:30'">Set 17:30</ZButton>
      <ZButton variant="outline" tone="neutral" @click="value = null">Clear</ZButton>
    </ZStack>
    <span>Value: {{ value ?? 'null' }}</span>
    <output>{{ log.join(' · ') }}</output>
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZTimePicker } from '@zelviora/vue';

// Component tokens and the `option-selected` part: see the `demo-time-picker-brand` rule in README.
</script>

<template>
  <ZTimePicker class="demo-narrow demo-time-picker-brand" label="Appointment time" value="10:30" />
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZStack, ZTimePicker } from '@zelviora/vue';

// Type hours and minutes, or press Alt+ArrowDown to pick in the columns; "Now" is fixed so the demo never changes.
// v-model binds `value` through the model event `zChange`.
const value = ref<string | null>(null);
const now = () => '09:41';
</script>

<template>
  <ZStack class="demo-narrow">
    <ZTimePicker v-model="value" label="Appointment time" hint="Type hours:minutes or press Alt+↓ to open the list" clearable :now="now" />
    <span>Value: {{ value ?? 'null' }}</span>
  </ZStack>
</template>

```

### Case: form

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZField, ZStack, ZTimePicker } from '@zelviora/vue';

// Native form: the value is submitted as HH:mm (FormData), required inside a field, reset restores defaults.
const sent = ref('');

function submit(e: Event) {
  sent.value = JSON.stringify([...new FormData(e.currentTarget as HTMLFormElement).entries()]);
}
</script>

<template>
  <form class="demo-narrow" @submit.prevent="submit">
    <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" value="07:30" />
      <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
        <ZButton type="submit">Submit</ZButton>
        <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
      </ZStack>
      <output v-if="sent">{{ sent }}</output>
    </ZStack>
  </form>
</template>

```

### Case: i18n

#### Vue
```vue
<script setup lang="ts">
import { ZGrid, ZTimePicker } from '@zelviora/vue';

// The hour cycle follows the locale (vi 24 h, en-US 12 h with AM/PM); the value stays 24 h. Arabic in RTL.
</script>

<template>
  <ZGrid columns="1 sm:2" gap="md">
    <ZTimePicker label="Tiếng Việt (24 giờ)" locale="vi" value="14:30" />
    <ZTimePicker label="English US (12 hours)" locale="en-US" value="14:30" />
    <ZTimePicker label="Forced 12 hours in Vietnamese" locale="vi" hour-cycle="h12" value="14:30" />
    <div dir="rtl" lang="ar-EG">
      <ZTimePicker label="العربية" locale="ar-EG" value="14:30" />
    </div>
  </ZGrid>
</template>

```

### Case: seconds

#### Vue
```vue
<script setup lang="ts">
import { ZGrid, ZTimePicker } from '@zelviora/vue';

// Granularity: `second` adds a seconds segment and column (HH:mm:ss); `hour` keeps minutes at 00.
</script>

<template>
  <ZGrid columns="1 sm:2" gap="md">
    <ZTimePicker label="Time (seconds)" granularity="second" :second-step="5" value="08:15:30" />
    <ZTimePicker label="Hour slot" granularity="hour" value="08:00" />
  </ZGrid>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZGrid, ZTimePicker } from '@zelviora/vue';

// Empty, filled, disabled, readonly, invalid and display statuses; a long label in a narrow column wraps.
</script>

<template>
  <ZGrid columns="1 sm:2" gap="md">
    <ZTimePicker label="Empty" />
    <ZTimePicker label="With value" value="14:15" />
    <ZTimePicker label="Disabled" value="14:15" disabled />
    <ZTimePicker label="Readonly" value="14:15" readonly />
    <ZTimePicker label="Invalid" value="14:15" invalid />
    <ZTimePicker label="Warning" value="14:15" status="warning" />
    <ZTimePicker label="Success" value="14:15" status="success" />
    <ZTimePicker
      class="demo-narrow"
      label="Expected start time of the afternoon shift at the downtown branch"
     
      value="13:30"
    />
  </ZGrid>
</template>

```

### Case: steps

#### Vue
```vue
<script setup lang="ts">
import { ZTimePicker } from '@zelviora/vue';

// Office hours only (08:00–17:30) in 15-minute steps; PageUp/PageDown jump further, Home/End go to the limits.
</script>

<template>
  <ZTimePicker class="demo-narrow" label="Working hours" min="08:00" max="17:30" :minute-step="15" hint="08:00–17:30, 15-minute steps" />
</template>

```

### Case: unavailable

#### Vue
```vue
<script setup lang="ts">
import { ZTimePicker } from '@zelviora/vue';

// 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:');
</script>

<template>
  <ZTimePicker class="demo-narrow" label="Appointment time" :minute-step="30" :is-time-unavailable="isLunch">
    <span slot="footer">Lunch break 12:00–13:00</span>
  </ZTimePicker>
</template>

```

### Case: validation

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZStack, ZTimePicker } from '@zelviora/vue';

// Required, a range (min / max) with a localized message, and a value off the minute step.
</script>

<template>
  <form class="demo-narrow" @submit.prevent>
    <ZStack>
      <ZTimePicker name="start" label="Start time" required />
      <ZTimePicker name="office" label="Office hours (08:00–17:00)" min="08:00" max="17:00" value="18:30" />
      <ZTimePicker name="slot" label="15-minute step" :minute-step="15" value="10:10" hint="10:10 is not on a 15-minute step" />
      <ZButton type="submit">Submit</ZButton>
    </ZStack>
  </form>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZGrid, ZTimePicker } from '@zelviora/vue';

// Outline and filled field in every size.
</script>

<template>
  <ZGrid columns="1 sm:3" gap="md">
    <ZTimePicker label="Small" size="sm" value="08:30" />
    <ZTimePicker label="Medium" size="md" value="08:30" />
    <ZTimePicker label="Large" size="lg" value="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>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZTimeline, ZTimelineItem } from '@zelviora/vue';
</script>

<template>
  <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>
</template>

```

### Case: custom

#### Vue
```vue
<script setup lang="ts">
import { ZCard, ZLink, ZTimeline, ZTimelineItem } from '@zelviora/vue';
</script>

<template>
  <ZCard heading="Activity">
    <ZTimeline label="Activity">
      <ZTimelineItem heading="Anna commented" :heading-level="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" :heading-level="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>
</template>

```

### Case: horizontal

#### Vue
```vue
<script setup lang="ts">
import { ZTimeline, ZTimelineItem } from '@zelviora/vue';

const steps = ['Ordered', 'Confirmed', 'Packed', 'Shipped', 'Out for delivery', 'Delivered'];
</script>

<template>
  <ZTimeline label="Shipment" orientation="horizontal">
    <ZTimelineItem v-for="(heading, i) in steps" :key="heading" :heading="heading" :tone="i < 3 ? 'success' : 'neutral'">
      <span slot="opposite">Day {{ i + 1 }}</span>
    </ZTimelineItem>
  </ZTimeline>
</template>

```

### Case: layouts

#### Vue
```vue
<script setup lang="ts">
import { ZGrid, ZTimeline, ZTimelineItem } from '@zelviora/vue';

const layouts = ['start', 'alternate', 'end'] as const;
</script>

<template>
  <ZGrid columns="1 md:3" gap="lg">
    <ZTimeline v-for="layout in layouts" :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>
</template>

```

### Case: pending

#### Vue
```vue
<script setup lang="ts">
import { ZTimeline, ZTimelineItem } from '@zelviora/vue';

const hoursAgo = (h: number) => new Date(Date.now() - h * 3600_000).toISOString();
</script>

<template>
  <ZTimeline label="Import" pending pending-label="Importing contacts…">
    <ZTimelineItem heading="File uploaded" :time="hoursAgo(3)" time-format="relative" tone="success" />
    <ZTimelineItem heading="Columns mapped" :time="hoursAgo(1)" time-format="relative" tone="success" />
  </ZTimeline>
</template>

```

### Case: sizes

#### Vue
```vue
<script setup lang="ts">
import { ZGrid, ZTimeline, ZTimelineItem } from '@zelviora/vue';

const sizes = ['sm', 'md', 'lg'] as const;
</script>

<template>
  <ZGrid columns="1 md:3" gap="lg">
    <ZTimeline v-for="size in sizes" :key="size" :label="`Size ${size}`" :size="size">
      <ZTimelineItem heading="Created" time="2026-09-30" time-format="date" />
      <ZTimelineItem heading="Updated" time="2026-10-04" time-format="date" />
    </ZTimeline>
  </ZGrid>
</template>

```

### Case: tones

#### Vue
```vue
<script setup lang="ts">
import { ZTimeline, ZTimelineItem } from '@zelviora/vue';
</script>

<template>
  <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>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
// Notification with an action: it does not close by itself (MO-4); F8 moves focus to it.
import { ref } from 'vue';
import { ZButton, ZToastRegion, toast, ZStack } from '@zelviora/vue';

const files = ref(3);

function remove() {
  files.value--;
  toast({
    region: 'demo-action',
    variant: 'notification',
    heading: 'File deleted',
    description: 'report.pdf was moved to the trash.',
    action: { id: 'undo', label: 'Undo', onAction: () => files.value++ },
  });
}
</script>

<template>
  <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
    <ZToastRegion name="demo-action" placement="top-end" />
    <span>Files: {{ files }}</span>
    <ZButton variant="outline" tone="destructive" :disabled="files === 0" @click="remove">Delete a file</ZButton>
  </ZStack>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
// Put one region in the app layout; call toast() from anywhere.
import { ZButton, ZToastRegion, toast, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
    <ZToastRegion name="demo-default" />
    <ZButton @click="toast('Changes saved', { region: 'demo-default' })">Save</ZButton>
    <ZButton variant="outline" tone="success" @click="toast.success('Uploaded 3 files', { region: 'demo-default' })">
      Upload
    </ZButton>
    <ZButton variant="outline" tone="destructive" @click="toast.error('Could not reach the server', { region: 'demo-default' })">
      Fail
    </ZButton>
  </ZStack>
</template>

```

### Case: promise

#### Vue
```vue
<script setup lang="ts">
// A loading toast that turns into success or error when the promise settles.
import { ZButton, ZToastRegion, toast, ZStack } from '@zelviora/vue';

const fakeSave = () => new Promise<number>((resolve) => setTimeout(() => resolve(12), 1500));

function save() {
  void toast.promise(
    fakeSave(),
    { loading: 'Saving 12 records…', success: (n) => `Saved ${n} records`, error: 'Saving failed' },
    { region: 'demo-promise' },
  );
}
</script>

<template>
  <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
    <ZToastRegion name="demo-promise" placement="bottom" show-progress />
    <ZButton @click="save">Save records</ZButton>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZToggle } from '@zelviora/vue';
</script>

<template>
  <ZToggle default-pressed>Pin</ZToggle>
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZStack, ZToggle } from '@zelviora/vue';

// v-model binds `pressed` through the model event `zChange`.
const grid = ref(false);
const log = ref<string[]>([]);
function onChange(e: CustomEvent<{ pressed: boolean }>) {
  log.value = [`zChange pressed=${e.detail.pressed}`, ...log.value].slice(0, 3);
}
</script>

<template>
  <ZStack gap="sm">
    <ZStack orientation="horizontal" align-items="center" gap="sm" wrap>
      <ZToggle v-model="grid" variant="outline" @z-change="onChange">Grid view</ZToggle>
      <ZButton variant="ghost" tone="neutral" @click="grid = false">Reset from code</ZButton>
    </ZStack>
    <small>View: {{ grid ? 'grid' : 'list' }} · {{ log.join(' · ') || 'no event yet' }}</small>
  </ZStack>
</template>

```

### Case: toolbar

#### Vue
```vue
<script setup lang="ts">
import { computed, ref } from 'vue';
import { ZButtonGroup, ZStack, ZText, ZToggle } from '@zelviora/vue';

const bold = ref(true);
const italic = ref(false);
const underline = ref(false);
const active = computed(
  () =>
    Object.entries({ bold: bold.value, italic: italic.value, underline: underline.value })
      .filter(([, on]) => on)
      .map(([k]) => k)
      .join(', ') || 'none',
);
</script>

<template>
  <ZStack gap="sm">
    <ZButtonGroup label="Text format" detached>
      <ZToggle v-model="bold" size="sm" label="Bold">B</ZToggle>
      <ZToggle v-model="italic" size="sm" label="Italic">I</ZToggle>
      <ZToggle v-model="underline" size="sm" label="Underline">U</ZToggle>
    </ZButtonGroup>
    <ZText variant="muted" size="sm">Active: {{ active }}</ZText>
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZGrid, ZToggle } from '@zelviora/vue';

const variants = ['ghost', 'outline'] as const;
const sizes = ['sm', 'md', 'lg'] as const;
</script>

<template>
  <ZGrid columns="1 sm:3" gap="md">
    <template v-for="variant in variants" :key="variant">
      <ZToggle :variant="variant">{{ variant }} off</ZToggle>
      <ZToggle :variant="variant" pressed>{{ variant }} on</ZToggle>
      <ZToggle :variant="variant" pressed disabled>{{ variant }} disabled</ZToggle>
    </template>
    <ZToggle v-for="size in sizes" :key="size" :size="size" variant="outline">Size {{ size }}</ZToggle>
  </ZGrid>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZToggleGroup, ZToggleGroupItem } from '@zelviora/vue';
</script>

<template>
  <ZToggleGroup label="Text alignment" default-value="center">
    <ZToggleGroupItem value="left">Left</ZToggleGroupItem>
    <ZToggleGroupItem value="center">Center</ZToggleGroupItem>
    <ZToggleGroupItem value="right">Right</ZToggleGroupItem>
  </ZToggleGroup>
</template>

```

### Case: multiple

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZStack, ZToggleGroup, ZToggleGroupItem } from '@zelviora/vue';

const value = ref<string[]>(['bold']);
</script>

<template>
  <ZStack gap="sm">
    <ZToggleGroup v-model="value" multiple variant="outline" label="Formatting">
      <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>
</template>

```

### Case: vertical

#### Vue
```vue
<script setup lang="ts">
import { ZToggleGroup, ZToggleGroupItem } from '@zelviora/vue';
</script>

<template>
  <ZToggleGroup label="View density" orientation="vertical" size="sm" disallow-empty default-value="comfortable">
    <ZToggleGroupItem value="compact">Compact</ZToggleGroupItem>
    <ZToggleGroupItem value="comfortable">Comfortable</ZToggleGroupItem>
    <ZToggleGroupItem value="spacious" disabled>Spacious</ZToggleGroupItem>
  </ZToggleGroup>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZTooltip } from '@zelviora/vue';
</script>

<template>
  <ZTooltip content="Saves a draft you can finish later">
    <ZButton variant="outline" tone="neutral">Save draft</ZButton>
  </ZTooltip>
</template>

```

### Case: label

#### Vue
```vue
<script setup lang="ts">
// Icon-only buttons get their accessible name from the tooltip (kind="label").
import { ZButton, ZIcon, ZTooltip, ZStack } from '@zelviora/vue';
</script>

<template>
  <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
    <ZTooltip content="Next page" kind="label">
      <ZButton variant="ghost" tone="neutral">
        <ZIcon name="chevron_right" flip-rtl />
      </ZButton>
    </ZTooltip>
    <ZTooltip content="Remove filter" kind="label" placement="bottom">
      <ZButton variant="ghost" tone="neutral">
        <ZIcon name="close" />
      </ZButton>
    </ZTooltip>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZStack, ZText, ZTour, ZTourStep } from '@zelviora/vue';

// Controlled `index` (v-model), an intro step without target (centered) and no mask.
const open = ref(false);
const index = ref(0);

function start() {
  index.value = 0;
  open.value = true;
}
</script>

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
      <ZButton id="tour-vue-export" variant="outline" tone="neutral">Export</ZButton>
      <ZText variant="muted">Step {{ index + 1 }} of 2</ZText>
    </ZStack>
    <div>
      <ZButton variant="outline" @click="start">What is new?</ZButton>
    </div>
    <ZTour v-model="index" hide-mask :open="open" @z-open-change="open = $event.detail.open">
      <ZTourStep heading="Welcome to version 2">A short look at what changed.</ZTourStep>
      <ZTourStep target="#tour-vue-export" heading="Export" placement="right">Download any report as CSV or PDF.</ZTourStep>
    </ZTour>
  </ZStack>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZStack, ZTour, ZTourStep } from '@zelviora/vue';

const open = ref(false);
</script>

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" wrap gap="sm">
      <ZButton id="tour-vue-new">New project</ZButton>
      <ZButton id="tour-vue-search" variant="outline" tone="neutral">Search</ZButton>
      <ZButton id="tour-vue-settings" variant="ghost" tone="neutral">Settings</ZButton>
    </ZStack>
    <div>
      <ZButton variant="outline" @click="open = true">Start tour</ZButton>
    </div>
    <ZTour :open="open" @z-open-change="open = $event.detail.open">
      <ZTourStep target="#tour-vue-new" heading="Create a project">Start here: a project groups your boards and files.</ZTourStep>
      <ZTourStep target="#tour-vue-search" heading="Find anything">Search projects, people and files.</ZTourStep>
      <ZTourStep target="#tour-vue-settings" heading="Make it yours" placement="right">Theme, language and notifications live here.</ZTourStep>
    </ZTour>
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZStack, ZTransfer } from '@zelviora/vue';

// The app owns `value` (v-model): buttons set it from code (no event); the log lists moves and ticks.
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' },
];
const value = ref<string[]>(['read', 'comment']);
const log = ref<string[]>([]);
const add = (line: string) => { log.value = [line, ...log.value].slice(0, 5); };

function onChange(e: CustomEvent<{ direction: string; moved: string[] }>) {
  add(`zChange ${e.detail.direction} [${e.detail.moved.join(', ')}]`);
}
function onSelection(e: CustomEvent<{ selectedSource: string[]; selectedTarget: string[] }>) {
  add(`zSelectionChange [${e.detail.selectedSource.join(', ')}] [${e.detail.selectedTarget.join(', ')}]`);
}
function selectAll() {
  value.value = ROLES.filter((r) => !r.disabled).map((r) => r.value);
}
</script>

<template>
  <ZStack>
    <ZTransfer v-model="value" label="Permissions" :items="ROLES" @z-change="onChange" @z-selection-change="onSelection" />
    <ZStack orientation="horizontal" gap="sm" wrap>
      <ZButton variant="outline" tone="neutral" @click="selectAll">All</ZButton>
      <ZButton variant="outline" tone="neutral" @click="value = []">None</ZButton>
    </ZStack>
    <span>Value: {{ value.join(', ') || '—' }}</span>
    <output>{{ log.join(' · ') }}</output>
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZTransfer } from '@zelviora/vue';

// Transfer tokens and parts (`::part(option-selected)`): see the `demo-transfer-brand` rule in README.
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' },
];
</script>

<template>
  <ZTransfer class="demo-transfer-brand" label="Customization" :items="ROLES.slice(0, 6)" :value="['read']" :selected-source="['write']" />
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZStack, ZTransfer } from '@zelviora/vue';

// Tick items (click, Space, Shift+Arrow, Ctrl+A), then move them with the arrow buttons, Enter or a double click.
// v-model binds `value` through the model event `zChange`.
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' },
];
const value = ref<string[]>(['read']);
</script>

<template>
  <ZStack>
    <ZTransfer v-model="value" label="Permissions" :items="ROLES" />
    <span>Value: {{ value.join(', ') || '—' }}</span>
  </ZStack>
</template>

```

### Case: form

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZField, ZStack, ZTransfer } from '@zelviora/vue';

// Native form: one FormData entry per target value; required inside a field; reset restores the default value.
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' },
];
const sent = ref('');

function submit(e: Event) {
  sent.value = JSON.stringify(new FormData(e.currentTarget as HTMLFormElement).getAll('roles'));
}
</script>

<template>
  <form @submit.prevent="submit">
    <ZStack>
      <ZField label="Team permissions" hint="Select at least one permission" required>
        <ZTransfer name="roles" :items="ROLES" :default-value="['read']" :value="['read']" required />
      </ZField>
      <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
        <ZButton type="submit">Submit</ZButton>
        <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
      </ZStack>
      <output v-if="sent">{{ sent }}</output>
    </ZStack>
  </form>
</template>

```

### Case: i18n

#### Vue
```vue
<script setup lang="ts">
import { ZStack, ZTransfer } from '@zelviora/vue';

// Vietnamese locale: built-in strings are Vietnamese and search ignores accents ("dang" matches "Đăng bài").
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 },
];
</script>

<template>
  <ZStack>
    <ZTransfer lang="vi" label="Phân quyền" :items="ROLES" :value="['read']" searchable />
  </ZStack>
</template>

```

### Case: long

#### Vue
```vue
<script setup lang="ts">
import { ZTransfer } from '@zelviora/vue';

// 10 000 items: each list scrolls virtually (above 200 items); typeahead and Shift+Arrow still work.
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}`,
}));
</script>

<template>
  <ZTransfer label="Users" :items="MANY" searchable />
</template>

```

### Case: one-way

#### Vue
```vue
<script setup lang="ts">
import { ZTransfer } from '@zelviora/vue';

// One way: items only move to the target; each target item has its own remove button.
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' },
];
</script>

<template>
  <ZTransfer label="Notification recipients" :items="ROLES" :value="['read', 'write']" one-way :titles="['Available', 'Receives notifications']" />
</template>

```

### Case: rtl

#### Vue
```vue
<script setup lang="ts">
import { ZStack, ZTransfer } from '@zelviora/vue';

// RTL swaps the move arrows; with no item both lists show their empty state (slot `empty-source`).
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' },
];
</script>

<template>
  <ZStack gap="lg">
    <div dir="rtl" lang="ar">
      <ZTransfer label="RTL" :items="ROLES.slice(0, 4)" :value="['read']" />
    </div>
    <ZTransfer label="Empty" :items="[]">
      <span slot="empty-source">No permissions yet</span>
    </ZTransfer>
  </ZStack>
</template>

```

### Case: searchable

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZStack, ZTransfer } from '@zelviora/vue';

// Search on each side (case-insensitive: "publish" matches "Publish posts"); results are announced.
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' },
];
const query = ref('');
</script>

<template>
  <ZStack>
    <ZTransfer label="Permissions" :items="ROLES" searchable @z-search="query = `${$event.detail.side}: ${$event.detail.query}`" />
    <span>zSearch: {{ query || '—' }}</span>
  </ZStack>
</template>

```

### Case: sizes

#### Vue
```vue
<script setup lang="ts">
import { ZStack, ZTransfer } from '@zelviora/vue';

// Small, medium (default) and large rows.
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' },
];
const SIZES = ['sm', 'md', 'lg'] as const;
</script>

<template>
  <ZStack gap="lg">
    <ZTransfer v-for="size in SIZES" :key="size" :label="`Size ${size}`" :size="size" :items="ROLES.slice(0, 4)" :value="['read']" />
  </ZStack>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack, ZTransfer } from '@zelviora/vue';

// A disabled item ("Billing"), ticked items, the whole control disabled, readonly and invalid.
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' },
];
</script>

<template>
  <ZStack gap="lg">
    <ZTransfer label="Ticked items and a disabled item" :items="ROLES" :value="['read']" :selected-source="['write', 'edit']" />
    <ZTransfer label="Disabled" :items="ROLES.slice(0, 4)" :value="['read']" disabled />
    <ZTransfer label="Readonly" :items="ROLES.slice(0, 4)" :value="['read']" readonly />
    <ZTransfer label="Invalid" :items="ROLES.slice(0, 4)" invalid hint="Select at least one permission" />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZTreeChart } from '@zelviora/vue-chart';
import { topologyTree, topologySeries } from '../data.ts';
</script>

<template>
  <ZTreeChart
    heading="Platform Service Topology Tree"
    description="Hierarchical topology from Edge Ingress down to regional microservice clusters."
    :tree-data="topologyTree" :series="topologySeries"
  />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/vue';
import {
  ZTreeChart,
  type ChartPointSelectDetail,
  type ChartSeriesToggleDetail,
} from '@zelviora/vue-chart';
import { topologyTree, topologySeries } from '../data.ts';

const hidden = ref<string[]>([]);
const selected = ref('Click any chart element to inspect');

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

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

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" gap="sm" align-items="center" wrap>
      <ZButton size="sm" variant="outline" @click="hidden = []">
        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."
      :tree-data="topologyTree" :series="topologySeries"
      selectable
      :hidden-series="hidden"
      @z-series-toggle="onToggle"
      @z-point-select="onSelect"
    />
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZTreeChart } from '@zelviora/vue-chart';
import { topologyTree, topologySeries } from '../data.ts';
</script>

<template>
  <ZTreeChart
    class="demo-chart-brand"
    description="Hierarchical topology from Edge Ingress down to regional microservice clusters."
    :value-format="{ maximumFractionDigits: 1 }"
    :tree-data="topologyTree" :series="topologySeries" roam :symbol-size="12" renderer="canvas"
  >
    <span slot="heading">Platform Service Topology Tree — Custom Theme Tokens &amp; Canvas</span>
  </ZTreeChart>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZTreeChart } from '@zelviora/vue-chart';
import { topologyTree, topologySeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZTreeChart
      heading="Loading State (aria-busy)"
      loading
      :tree-data="topologyTree" :series="topologySeries"
    />
    <ZTreeChart
      heading="Empty State"
      :tree-data="[]"
      :series="topologySeries"
    />
    <ZTreeChart
      heading="Expanded Accessible Data Table"
      description="Hierarchical topology from Edge Ingress down to regional microservice clusters."
      show-data-table
      :tree-data="topologyTree" :series="topologySeries"
    />
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZTreeChart } from '@zelviora/vue-chart';
import { topologyTree, topologySeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZTreeChart
      heading="Top-to-Bottom Orthogonal Tree"
      description="Top-to-bottom orthogonal hierarchy vs radial circular tree layout."
      :tree-data="topologyTree" :series="topologySeries" tree-layout="orthogonal" tree-orient="TB" :symbol-size="10"
    />
    <ZTreeChart
      heading="Radial Tree Layout"
      description="Top-to-bottom orthogonal hierarchy vs radial circular tree layout."
      :tree-data="topologyTree" :series="topologySeries" tree-layout="radial" :initial-tree-depth="2"
    />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZStack, ZTreeSelect } from '@zelviora/vue';
import { departments } from '../data.ts';

// Tri-state check boxes with cascade; the value kept follows checkStrategy (parent / child / all).
const STRATEGIES = ['parent', 'child', 'all'] as const;
const values = ref<Record<string, string[]>>({ parent: ['eng'], child: ['eng'], all: ['eng'] });

function onChange(s: string, e: CustomEvent<{ value: string | string[] | null }>) {
  values.value = { ...values.value, [s]: e.detail.value as string[] };
}
</script>

<template>
  <ZStack class="demo-narrow">
    <ZStack v-for="s in STRATEGIES" :key="s" gap="xs">
      <ZTreeSelect :label="`checkStrategy: ${s}`" checkable :check-strategy="s" max-tag-count="responsive" :options="departments" :value="values[s]" @z-change="onChange(s, $event)" />
      <span>Value: {{ values[s]!.join(', ') || 'none' }}</span>
    </ZStack>
  </ZStack>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZStack, ZTreeSelect } from '@zelviora/vue';
import { departments } from '../data.ts';

// Single value at any level, a disabled node, clear button; disabled and readonly states.
const value = ref<string | string[] | null>('be');
</script>

<template>
  <ZStack class="demo-narrow">
    <ZTreeSelect v-model="value" label="Departments" :options="departments" clearable />
    <span>Value: {{ value ?? 'null' }}</span>
    <ZTreeSelect label="Disabled" :options="departments" value="acc" disabled />
    <ZTreeSelect label="Readonly" :options="departments" value="acc" readonly variant="filled" />
  </ZStack>
</template>

```

### Case: form

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZStack, ZTreeSelect } from '@zelviora/vue';
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.
const sent = ref('');

function submit(e: Event) {
  const data = new FormData(e.currentTarget as HTMLFormElement);
  sent.value = JSON.stringify({ teams: data.getAll('teams'), item: data.get('item') });
}
</script>

<template>
  <form class="demo-narrow" @submit.prevent="submit">
    <ZStack>
      <ZTreeSelect name="teams" label="Departments" hint="Required" required checkable check-strategy="child" :options="departments" />
      <ZTreeSelect name="item" label="Large catalog (5,000 nodes)" searchable :options="bigTree" />
      <ZStack orientation="horizontal" wrap align-items="center" gap="sm">
        <ZButton type="submit">Submit</ZButton>
        <ZButton type="reset" variant="outline" tone="neutral">Reset</ZButton>
      </ZStack>
      <output v-if="sent">{{ sent }}</output>
    </ZStack>
  </form>
</template>

```

### Case: i18n

#### Vue
```vue
<script setup lang="ts">
import { ZConfigProvider, ZTreeSelect } from '@zelviora/vue';
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.
</script>

<template>
  <ZConfigProvider locale="vi">
    <div class="demo-narrow">
      <ZTreeSelect label="Tìm phòng ban" searchable :options="departments" />
    </div>
  </ZConfigProvider>
</template>

```

### Case: multiple

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZStack, ZTreeSelect } from '@zelviora/vue';
import { departments } from '../data.ts';

// Several nodes as tags (the popup stays open); at most 3 values.
const value = ref<string | string[] | null>(['web', 'acc']);
</script>

<template>
  <ZStack class="demo-narrow">
    <ZTreeSelect v-model="value" label="Owner groups" multiple clearable :max-count="3" :options="departments" />
    <span>Value: {{ (value as string[]).join(', ') || 'none' }}</span>
  </ZStack>
</template>

```

### Case: search

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZStack, ZTreeSelect } from '@zelviora/vue';
import { departments, lazyRoots, loadOffices } from '../data.ts';

// Search shows matches with their ancestors; children loaded on expand.
const query = ref('');

function onSearch(e: CustomEvent<{ query: string }>) {
  query.value = e.detail.query;
}
</script>

<template>
  <ZStack class="demo-narrow">
    <ZTreeSelect label="Find department" searchable :options="departments" @z-search="onSearch" />
    <span>Query: {{ query || '—' }}</span>
    <ZTreeSelect label="Offices (lazy)" :options="lazyRoots" :load-children="loadOffices" />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZStack, ZTreeView } from '@zelviora/vue';
import { departments } from '../data.ts';

// Tri-state check boxes with cascade (the disabled team is skipped); `checkedValue` bound back from the event.
const checked = ref<string[]>(['fe']);

function onChecked(e: CustomEvent<{ checkedValue: string[] }>) {
  checked.value = e.detail.checkedValue;
}
</script>

<template>
  <ZStack class="demo-narrow">
    <ZTreeView
      label="Departments"
      checkable
      selection-mode="none"
      :items="departments"
      :checked-value="checked"
      :default-expanded-value="['eng', 'fin']"
      @z-checked-change="onChecked"
    />
    <span>Checked: {{ checked.length ? checked.join(', ') : 'none' }}</span>
  </ZStack>
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZStack, ZTreeView } from '@zelviora/vue';
import { folders } from '../data.ts';

// The app owns `value` (v-model) and `expandedValue`: buttons set them from code (no event), user changes come back by event.
const ALL_PARENTS = ['docs', 'reports', 'images'];
const value = ref<string | string[] | null>(null);
const expanded = ref<string[]>([]);

function onExpanded(e: CustomEvent<{ expandedValue: string[] }>) {
  expanded.value = e.detail.expandedValue;
}
function selectQ2() {
  expanded.value = ['docs', 'reports'];
  value.value = 'q2';
}
</script>

<template>
  <ZStack class="demo-narrow">
    <ZStack orientation="horizontal" gap="sm" wrap>
      <ZButton variant="outline" tone="neutral" @click="expanded = ALL_PARENTS">Expand all</ZButton>
      <ZButton variant="outline" tone="neutral" @click="expanded = []">Collapse all</ZButton>
      <ZButton variant="outline" tone="neutral" @click="selectQ2">Select Q2</ZButton>
    </ZStack>
    <ZTreeView v-model="value" label="Folders" :items="folders" :expanded-value="expanded" @z-expanded-change="onExpanded" />
    <span>Value: {{ value ?? 'null' }} · Expanded: {{ expanded.join(', ') || 'none' }}</span>
  </ZStack>
</template>

```

### Case: declarative

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZButton, ZStack, ZTreeItem, ZTreeView } from '@zelviora/vue';

// 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.
const value = ref<string | null>('q1');
const drafts = ref<string[]>([]);

function onSelection(e: CustomEvent<{ value: string | string[] | null }>) {
  value.value = e.detail.value as string | null;
}
</script>

<template>
  <ZStack class="demo-narrow">
    <ZStack orientation="horizontal" gap="sm" wrap>
      <ZButton variant="outline" tone="neutral" @click="drafts.push(`draft-${drafts.length + 1}`)">Add draft</ZButton>
      <ZButton variant="outline" tone="neutral" :disabled="!drafts.length" @click="drafts.pop()">Remove draft</ZButton>
    </ZStack>
    <ZTreeView label="Documents" :value="value" :default-expanded-value="['docs', 'reports']" @z-selection-change="onSelection">
      <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>
        <ZTreeItem v-for="(d, i) in drafts" :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>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZStack, ZTreeView } from '@zelviora/vue';
import { folders } from '../data.ts';

// Three levels of folders, single selection, a disabled node (focusable, not selectable), three sizes.
const value = ref<string | null>('q1');

function onSelection(e: CustomEvent<{ value: string | string[] | null }>) {
  value.value = e.detail.value as string | null;
}
</script>

<template>
  <ZStack class="demo-narrow">
    <ZTreeView label="Folders" :items="folders" :value="value" :default-expanded-value="['docs', 'reports']" @z-selection-change="onSelection" />
    <span>Value: {{ value ?? 'null' }}</span>
    <ZTreeView label="Folders (small)" size="sm" :items="folders" />
    <ZTreeView label="Folders (large)" size="lg" :items="folders" />
  </ZStack>
</template>

```

### Case: lazy

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZStack, ZTreeView } from '@zelviora/vue';
import { lazyRoots, loadRegions } from '../data.ts';

// Children loaded on expand (fixed delay); "Archive" fails once: the error event fires, expanding again retries.
const log = ref('');

function onError(e: CustomEvent<{ node: { label: string } }>) {
  log.value = `zError: ${e.detail.node.label}`;
}
</script>

<template>
  <ZStack class="demo-narrow">
    <ZTreeView label="Regions" :items="lazyRoots" :load-children="loadRegions" @z-error="onError" />
    <output>{{ log }}</output>
    <ZTreeView label="Empty" :items="[]" />
  </ZStack>
</template>

```

### Case: virtual

#### Vue
```vue
<script setup lang="ts">
import { ZTreeView } from '@zelviora/vue';
import { bigExpanded, bigTree } from '../data.ts';

// 10 100 visible nodes: only the rows in view are rendered (virtual="auto" above 500 visible nodes).
</script>

<template>
  <ZTreeView class="demo-tree-frame" label="Large catalog" selection-mode="multiple" :items="bigTree" :default-expanded-value="bigExpanded" />
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZTreemapChart } from '@zelviora/vue-chart';
import { bundleTree, bundleSeries } from '../data.ts';
</script>

<template>
  <ZTreemapChart
    heading="Workspace Bundle Size Breakdown (kB)"
    description="Hierarchical distribution of compiled asset sizes across packages."
    :tree-data="bundleTree" :series="bundleSeries"
  />
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZBadge, ZButton, ZStack, ZText } from '@zelviora/vue';
import {
  ZTreemapChart,
  type ChartPointSelectDetail,
  type ChartSeriesToggleDetail,
} from '@zelviora/vue-chart';
import { bundleTree, bundleSeries } from '../data.ts';

const hidden = ref<string[]>([]);
const selected = ref('Click any chart element to inspect');

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

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

<template>
  <ZStack gap="md">
    <ZStack orientation="horizontal" gap="sm" align-items="center" wrap>
      <ZButton size="sm" variant="outline" @click="hidden = []">
        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."
      :tree-data="bundleTree" :series="bundleSeries"
      selectable
      :hidden-series="hidden"
      @z-series-toggle="onToggle"
      @z-point-select="onSelect"
    />
  </ZStack>
</template>

```

### Case: customization

#### Vue
```vue
<script setup lang="ts">
import { ZTreemapChart } from '@zelviora/vue-chart';
import { bundleTree, bundleSeries } from '../data.ts';
</script>

<template>
  <ZTreemapChart
    class="demo-chart-brand"
    description="Hierarchical distribution of compiled asset sizes across packages."
    :value-format="{ maximumFractionDigits: 1 }"
    :tree-data="bundleTree" :series="bundleSeries" roam="scale" renderer="canvas"
  >
    <span slot="heading">Workspace Bundle Size Breakdown (kB) — Custom Theme Tokens &amp; Canvas</span>
  </ZTreemapChart>
</template>

```

### Case: states

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZTreemapChart } from '@zelviora/vue-chart';
import { bundleTree, bundleSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZTreemapChart
      heading="Loading State (aria-busy)"
      loading
      :tree-data="bundleTree" :series="bundleSeries"
    />
    <ZTreemapChart
      heading="Empty State"
      :tree-data="[]"
      :series="bundleSeries"
    />
    <ZTreemapChart
      heading="Expanded Accessible Data Table"
      description="Hierarchical distribution of compiled asset sizes across packages."
      show-data-table
      :tree-data="bundleTree" :series="bundleSeries"
    />
  </ZStack>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZStack } from '@zelviora/vue';
import { ZTreemapChart } from '@zelviora/vue-chart';
import { bundleTree, bundleSeries } from '../data.ts';
</script>

<template>
  <ZStack gap="lg">
    <ZTreemapChart
      heading="Interactive Roam & Breadcrumb"
      description="Interactive roam & breadcrumb trail vs static overview without breadcrumbs."
      :tree-data="bundleTree" :series="bundleSeries" roam show-breadcrumb
    />
    <ZTreemapChart
      heading="Static Compact Treemap"
      description="Interactive roam & breadcrumb trail vs static overview without breadcrumbs."
      :tree-data="bundleTree" :series="bundleSeries" :show-breadcrumb="false"
    />
  </ZStack>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { computed, ref } from 'vue';
import { ZButton, ZStack, ZText, ZVirtualList } from '@zelviora/vue';
import { contactLabel, controlledDemo, initialRange, inRange, itemKey, valueStatus, type Range } from '../data.ts';

type VirtualListElement = HTMLElement & {
  scrollToIndex(index: number, options?: { align?: 'start' | 'center' | 'end' | 'auto' }): Promise<void>;
  scrollToKey(key: string, options?: { align?: 'start' | 'center' | 'end' | 'auto' }): Promise<void>;
};

// The app holds the listbox `value` (v-model through `zSelect`) and scrolls from outside with `scrollToIndex` /
// `scrollToKey` (methods of the element: `$el` of the component instance).
const { items } = controlledDemo;
const value = ref<string | undefined>(controlledDemo.value);
const list = ref<{ $el: VirtualListElement } | null>(null);
const range = ref<Range>(initialRange);
const rendered = computed(() => inRange(items, range.value));

function showSelected() {
  if (value.value) void list.value?.$el.scrollToKey(value.value, { align: 'center' });
}
function onRange(e: CustomEvent<Range>) {
  range.value = e.detail;
}
</script>

<template>
  <ZStack gap="sm">
    <ZStack orientation="horizontal" gap="sm" wrap>
      <ZButton size="sm" variant="outline" tone="neutral" @click="list?.$el.scrollToIndex(0, { align: 'start' })">{{ controlledDemo.first }}</ZButton>
      <ZButton size="sm" variant="outline" tone="neutral" @click="showSelected">{{ controlledDemo.showSelected }}</ZButton>
      <ZButton size="sm" variant="outline" tone="neutral" @click="list?.$el.scrollToIndex(items.length - 1, { align: 'end' })">{{ controlledDemo.last }}</ZButton>
      <ZButton size="sm" variant="outline" tone="neutral" @click="value = controlledDemo.pick">{{ controlledDemo.select }}</ZButton>
    </ZStack>
    <ZVirtualList ref="list" v-model="value" :items="items" :get-item-key="itemKey" :format-label="contactLabel" list-role="listbox"
      :label="controlledDemo.label" class="demo-virtual-list" @z-range-change="onRange">
      <div v-for="c in rendered" :key="c.key" :slot="`item-${c.key}`" class="demo-virtual-row">{{ c.name }}</div>
    </ZVirtualList>
    <ZText variant="muted" size="sm">{{ valueStatus(value) }}</ZText>
  </ZStack>
</template>

```

### Case: default

#### Vue
```vue
<script setup lang="ts">
import { computed, ref } from 'vue';
import { ZVirtualList } from '@zelviora/vue';
import { defaultDemo, initialRange, inRange, itemKey, type Range } 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).
const range = ref<Range>(initialRange);
const rendered = computed(() => inRange(defaultDemo.items, range.value));

function onRange(e: CustomEvent<Range>) {
  range.value = e.detail;
}
</script>

<template>
  <ZVirtualList :items="defaultDemo.items" :get-item-key="itemKey" :label="defaultDemo.label" class="demo-virtual-list" @z-range-change="onRange">
    <div v-for="c in rendered" :key="c.key" :slot="`item-${c.key}`" class="demo-virtual-row">{{ defaultDemo.row(c) }}</div>
  </ZVirtualList>
</template>

```

### Case: grouped

#### Vue
```vue
<script setup lang="ts">
import { computed, ref } from 'vue';
import { ZVirtualList } from '@zelviora/vue';
import { groupedDemo, initialRange, inRange, itemKey, type Range } from '../data.ts';

// A–Z directory: `groups` (data, sorted by `start`) render sticky group headers labelled by their letter.
const range = ref<Range>(initialRange);
const rendered = computed(() => inRange(groupedDemo.items, range.value));

function onRange(e: CustomEvent<Range>) {
  range.value = e.detail;
}
</script>

<template>
  <ZVirtualList :items="groupedDemo.items" :groups="groupedDemo.groups" :get-item-key="itemKey" :label="groupedDemo.label"
    class="demo-virtual-list" @z-range-change="onRange">
    <div v-for="c in rendered" :key="c.key" :slot="`item-${c.key}`" class="demo-virtual-row">{{ c.name }}</div>
  </ZVirtualList>
</template>

```

### Case: load-more

#### Vue
```vue
<script setup lang="ts">
import { computed, onBeforeUnmount, ref } from 'vue';
import { ZSpinner, ZText, ZVirtualList } from '@zelviora/vue';
import { initialRange, inRange, itemKey, loadMoreDemo, makePosts, nextPage, type Post, type Range } from '../data.ts';

// Infinite loading: `loadMore` while data remains, `zLoadMore` near the end, `loading` while the next page arrives.
const items = ref<Post[]>(makePosts(loadMoreDemo.page));
const loading = ref(false);
const range = ref<Range>(initialRange);
const rendered = computed(() => inRange(items.value, range.value));
let timer: ReturnType<typeof setTimeout> | undefined;
onBeforeUnmount(() => clearTimeout(timer));

function more() {
  loading.value = true;
  timer = setTimeout(() => {
    items.value = nextPage(items.value);
    loading.value = false;
  }, loadMoreDemo.delay);
}
function onRange(e: CustomEvent<Range>) {
  range.value = e.detail;
}
</script>

<template>
  <ZVirtualList :items="items" :get-item-key="itemKey" :loading="loading" :load-more="items.length < loadMoreDemo.total"
    :label="loadMoreDemo.label" class="demo-virtual-list" @z-load-more="more" @z-range-change="onRange">
    <div v-for="p in rendered" :key="p.key" :slot="`item-${p.key}`" class="demo-virtual-row">{{ p.title }}</div>
    <ZSpinner slot="loading" :label="loadMoreDemo.loading" />
    <ZText slot="empty" variant="muted">{{ loadMoreDemo.empty }}</ZText>
  </ZVirtualList>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { computed, ref } from 'vue';
import { ZGrid, ZStack, ZText, ZVirtualList } from '@zelviora/vue';
import { contactLabel, initialRange, inRange, itemKey, postLabel, variantsDemo, type Range } from '../data.ts';

// `listRole` feed (APG Feed: PageDown / PageUp move between articles) and listbox (single selection, typeahead).
const { feed, listbox } = variantsDemo;
const feedRange = ref<Range>(feed.initialRange);
const feedItems = computed(() => inRange(feed.items, feedRange.value));
const boxRange = ref<Range>(initialRange);
const boxItems = computed(() => inRange(listbox.items, boxRange.value));

function onFeedRange(e: CustomEvent<Range>) {
  feedRange.value = e.detail;
}
function onBoxRange(e: CustomEvent<Range>) {
  boxRange.value = e.detail;
}
</script>

<template>
  <ZGrid columns="1 sm:2" gap="lg">
    <ZVirtualList :items="feed.items" :get-item-key="itemKey" :format-label="postLabel" list-role="feed" dynamic-size
      :label="feed.label" class="demo-virtual-list" @z-range-change="onFeedRange">
      <div v-for="p in feedItems" :key="p.key" :slot="`item-${p.key}`" class="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 :items="listbox.items" :get-item-key="itemKey" :format-label="contactLabel" list-role="listbox"
      :label="listbox.label" class="demo-virtual-list" @z-range-change="onBoxRange">
      <div v-for="c in boxItems" :key="c.key" :slot="`item-${c.key}`" class="demo-virtual-row">{{ c.name }}</div>
    </ZVirtualList>
  </ZGrid>
</template>

```


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

#### Vue
```vue
<script setup lang="ts">
import { ZCard, ZWatermark } from '@zelviora/vue';
</script>

<template>
  <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>
</template>

```

### Case: controlled

#### Vue
```vue
<script setup lang="ts">
import { computed, ref } from 'vue';
import { ZCard, ZInput, ZStack, ZWatermark } from '@zelviora/vue';

// The app formats the date for the locale.
const today = new Intl.DateTimeFormat('en-US', { dateStyle: 'short' }).format(new Date());
const user = ref('anna.lee');
const lines = computed(() => [user.value || '—', today]);
</script>

<template>
  <ZStack gap="sm">
    <ZInput v-model="user" class="demo-narrow" label="User" />
    <ZWatermark :text="lines">
      <ZCard heading="Payroll"><p>The watermark follows the user name.</p><p>October payroll.</p></ZCard>
    </ZWatermark>
  </ZStack>
</template>

```

### Case: form

#### Vue
```vue
<script setup lang="ts">
import { ZButton, ZField, ZInput, ZStack, ZWatermark } from '@zelviora/vue';
</script>

<template>
  <ZWatermark text="Draft">
    <form class="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>
</template>

```

### Case: protect

#### Vue
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { ZCard, ZStack, ZWatermark } from '@zelviora/vue';

const log = ref<string[]>([]);
const onTamper = (e: CustomEvent<{ reason: string }>) => log.value.push(e.detail.reason);
</script>

<template>
  <ZStack gap="sm">
    <ZWatermark protect text="Internal use only" @z-tamper="onTamper">
      <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>
</template>

```

### Case: table

#### Vue
```vue
<script setup lang="ts">
import { ZTable, ZWatermark } from '@zelviora/vue';

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

<template>
  <ZWatermark text="Confidential – HR" class="demo-watermark-brand">
    <ZTable caption="Salaries" row-header="name" :columns="columns" :rows="rows" />
  </ZWatermark>
</template>

```

### Case: variants

#### Vue
```vue
<script setup lang="ts">
import { ZCard, ZGrid, ZWatermark } from '@zelviora/vue';

// 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";
const lines = ['Confidential', 'anna.lee', '05/10/2026'];
const gap: [number, number] = [60, 60];
</script>

<template>
  <ZGrid columns="1 md:2" gap="md">
    <ZWatermark :text="lines" :rotate="-30" :tile-gap="gap">
      <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>
</template>

```

