# XWUISalesLeaderboard

Ranks sales reps by closed revenue, deals won, or quota attainment
(`config.metric`, default `'revenue'`): a four-tile `XWUIDisplayStatistic` KPI
strip (Total Revenue, Deals Won, Avg. Attainment, Top Performer), a
`XWUIChartHorizontalBar` of the top-N ranked reps, and the full ranked list in
`XWUITable`. `config.limit` caps the chart and table to the top N; the KPI
strip always aggregates every rep.

This is the second sales workbench (alongside `XWUIDealWorkbench`) that makes
`XWUISuperSales` genuinely functional - a manager's second screen after the
deal list. `XWUISuperSales`'s own `examples/LeaderboardArabic.ts` already
deep-linked onto the `sales-leaderboard` menu key before this component
existed; it now renders real content there instead of the placeholder.

A rep with no `quota` scores **0** for the `'attainment'` metric (rather than
`NaN` or being dropped) - a documented simplification, not a silent drop: the
rep still appears in the table, sorted last, with an attainment cell of `—`.
`data.currentUserId` suffixes that rep's own row with `" (You)"` rather than
requiring a bespoke highlight channel `XWUITable` does not expose.

## Basic Usage

Five reps ranked by closed revenue, one of them flagged as the signed-in user.

```example
file: examples/BasicUsage.ts
html: examples/BasicUsage.html
title: Basic Usage
description: Five reps ranked by closed revenue (the default metric), one flagged as the signed-in user via currentUserId.
```

## Ranked by Deals Won

```example
file: examples/ByDealsWon.ts
html: examples/ByDealsWon.html
title: Ranked by Deals Won
description: config.metric 'dealsWon' re-ranks the same reps by deal count, config.limit 3 caps the chart and table to the top three.
```

## Loading

```example
file: examples/Loading.ts
html: examples/Loading.html
title: Loading
description: A data source that has not resolved yet renders XWUISkeleton.
```

## RTL (Arabic)

```example
file: examples/RtlArabic.ts
html: examples/RtlArabic.html
title: RTL (Arabic)
description: The same leaderboard with Arabic rep names under direction 'rtl' and SAR currency formatting.
```

```api
```
